I'm sure I've seen several methods posted here in ...
# suitescript
j
I'm sure I've seen several methods posted here in the past but what is the most efficient way to iterate over several thousand (17,000+) search results?
h
This is what i use to fetch records with several thousand of records for saved search.
function ss_result(searchname) { var m = []; var search = nlapiLoadSearch(null,searchname); var rscnt = 1000; var nextStartIndex = 0; var nextEndIndex = 1000; var searchResultSet = search.runSearch(); while(rscnt == 1000) { var rs = searchResultSet.getResults(nextStartIndex, nextEndIndex); if(rs != null) { m = m.concat(rs); rscnt = rs.length; } else { rscnt = 0; } nextStartIndex = nextEndIndex; nextEndIndex = nextEndIndex + 1000; } return m; }
👍 1