我无法阅读所有记录。它只读取第一页索引记录。我想读取所有页面的所有重新记录。总记录是2055年,但前1000个记录只读。 Kinldy有人会尽快帮助解决这个问题。
TransactionSearchAdvanced ticketSearch = new TransactionSearchAdvanced();
ticketSearch.savedSearchId = "287";
SearchResult results = new SearchResult();
results = _service.search(ticketSearch);
// If everything was okay, start processing records
if (results.status.isSuccess)
{
foreach (SearchResult sr in searchMoreResults)
{
//System.Console.WriteLine("Results found.");
foreach (SearchRow searchRow in results.searchRowList)
{
TransactionSearchRow SaleTicket = (TransactionSearchRow)searchRow;
if (SaleTicket.basic != null)
{
if (SaleTicket.basic.tranId != null)
{
SearchColumnStringField[] scsf = SaleTicket.basic.tranId;
variables.salesOrderNumber = scsf[0].searchValue;
SearchColumnSelectField[] Field = SaleTicket.basic.entity;
RecordRef rr = Field[0].searchValue;
if (!string.IsNullOrEmpty(rr.internalId))
{
variables.customerNsInternalID = rr.internalId;
}
variables.customerIdIntergerPart = Convert.ToInt32(variables.salesOrderNumber.Substring((variables.salesOrderNumber.IndexOf("-") + 1)));
InsertSalesOrderRecords(variables);
}
}
}
}
}
答案 0 :(得分:2)
不确定如何使用C#和Web服务来实现它,但这就是我使用SuiteScript
的方法var savedSearch = nlapiLoadSearch(recordType, searchId);
var resultset = savedSearch.runSearch();
var returnSearchResults = [];
var searchid = 0;
do {
var resultslice = resultset.getResults(searchid, searchid + 1000);
for ( var rs in resultslice) {
returnSearchResults.push(resultslice[rs]);
searchid++;
}
} while (resultslice.length >= 1000);
return returnSearchResults;
答案 1 :(得分:1)
根据this answer,1000条记录是一个硬性限制。查看this question的答案,了解您问题的可能解决方案。
答案 2 :(得分:0)
这是伪代码(我主要是javascript,所以这将是伪伪代码;)
b_keepLoop = true, b_internalId = false;
while (b_keepLoop){
var a_filters = [];
if(b_internalId){
a_filters.push(new nlobjSearchFilter('internalidnumber', null, 'greaterthanorequalto', i_lastTranId));
}
searchResults = nlapiSearchRecord('transaction', a_searchName[0], a_filters); //10 units
/**do whatever you want for your actual code**/
if (searchResults.length >= 1000) {
i_lastTranId = searchResults[(searchResults.length - 1)].getId();
b_internalId = true;
}
else {
b_keepLoop = false;
}