Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Search batch size parameter

hayden-t edited this page Apr 22, 2017 · 3 revisions

Search results in netsuite are generally limited to a maximum of 1000. To get around this rest_suite runs a while loop repeatedly requesting results and accumulating them until it has them all, unless...

This is where batch size comes in, it lets you specify a number greater than 1000 that the searcher will stop at if you dont want to request all records.

Initially i thought it could be used to specify a page size / result set eg less than 1000, but this is not so.

It would be possible with nlapiSearchRecord, rather nlapiCreateSearch. (see http://stackoverflow.com/questions/33437295/how-to-set-page-size-for-records-in-netsuite-using-restlet)

Here is the logic code from search.js that handles batch size:

Searcher.prototype.isExecutionDone = function(resultsBlock) {
    if(!resultsBlock) { return true }
    allResultsFound = resultsBlock.length != 1000;
    batchSizeMet    = this.results.length >= this.batchSize;
    return allResultsFound || batchSizeMet;
 }
Clone this wiki locally