This topic contains 5 replies, has 0 voices, and was last updated by ironside 7 years, 3 months ago.

  • Author
    Posts
  • #6495 Score: 0

    DLVanGeest
    • Contributions: 0
    • Level 1

    I have an API call to retrieve all of the invoices that have been added/modified within the past week. However, not all of the invoices are returned when I make this call. Here is how I have built the transaction search:

    // Create the search criteria var tSearch = new TransactionSearchBasic { lastModifiedDate = new SearchDateField { operatorSpecified = true, @operator = SearchDateFieldOperator.within, searchValueSpecified = true, searchValue = LastModified, searchValue2Specified = true, searchValue2 = EndDate }, recordType = new SearchStringField { operatorSpecified = true, @operator = SearchStringFieldOperator.contains, searchValue = TransactionType } }; with LastModified set to the start of the seven-day period and EndDate set to the end. The TransactionType is set to “invoice”. Is there anything else that I am missing?
    This is a cached copy. Click here to see the original post.

  • #6496 Score: 0

    Olivier Gagnon NC
    • Contributions: 0
    • Level 1

    Could it be a timezone issue with the lastmodified timestamp and your variable?

    Anything particular you have observed in regards to the invoices being missed?

  • #6497 Score: 0

    DLVanGeest
    • Contributions: 0
    • Level 1

    Not a time zone issue. As far as the invoices being missed, they fall within the search window. I get most of the invoices that have been created/modified within the search window but not all of them. That is why this problem is so perplexing to me.

  • #6498 Score: 0

    khultquist
    • Contributions: 0
    • Level 1

    How many records is the query returning, is it by chance exactly 1,000?

  • #6499 Score: 0

    DLVanGeest
    • Contributions: 0
    • Level 1

    50 at a time. Here is the code for the looping to retrieve the entire dataset:

    private static List ExecuteTransactionSearch(TransactionSearchBasic Search, string Title) { var transactions = new List(); Console.Write(“Retrieving {0} – page 1 …r”, Title); // Get the results try { var results = service.search(Search); if ((results.status.isSuccess) && results.pageSize > 0) { transactions.AddRange(results.recordList.ToList()) ; int remainder = 0; int totalPages = 0; if (results.pageSize != 0) totalPages = Math.DivRem(results.totalRecords, results.pageSize, out remainder); if (remainder != 0) totalPages++; while (results.pageIndex < totalPages) { Console.Write("Retrieving {0} – page {1} of {2} …r", Title, results.pageIndex + 1, totalPages); results = service.searchMore(results.pageIndex + 1); if (results.status.isSuccess) { transactions.AddRange(results.recordList.ToList()) ; } else { BuildStatusMessage(results.status.statusDetail); break; } } Console.WriteLine(""); } } catch (Exception e) { RecordMessage(e.InnerException == null ? e.Message : e.InnerException.Message); } return transactions; }

  • #6500 Score: 0

    ironside
    • Contributions: 0
    • Level 1

    p.s. this Isn’t a SuiteScript question. It’s a SuiteTalk question. https://usergroup.netsuite.com/users…ices-suitetalk

You must be logged in to reply to this topic.