What is the most efficient way of getting rows x t...
# suitescript
w
What is the most efficient way of getting rows x to y in a saved search (not SuiteQL)? The documentation says that search.run() produces a ResultSet. And ResultSet is said to have a maximum of 4000 rows.
search.run().getRange({ start: 5000, end: 5050 })
works fine in the console though. Is the 4000 row limitation only applicable to ResultSet.each()? Any insights?
👀 1
e
4,000
is the limit on the number of rows, not necessarily the limit on the index of the rows you can retrieve with
each()
. The limit on
getRange()
is just
1,000
e.g.
start: 5000, end: 5999
is fine, but
start: 0, end: 1500
is too many rows. From the Help docs for `getRange()`:
Unlimited rows in the result are supported, however you can only return 1,000 at a time based on the index values.
Typically if you want all results from a large search, you'll want to use the paging API starting with
runPaged()
instead of
run()
. The paging API will consume less governance than retrieving all the results with
getRange()
, and you won't have to re-run your search with new filters like you would to get them all with
each()
.
w
Ok, but since the request to the RESTlet can contain any values in start and end, I can't really do paging unless I create some arbitrary pagesize that fits into the request's start and end values. It seems easier then to do run().getRange({start: 145, end: 175}). But maybe it's not as efficient then.
b
use the pagedSearch if you are getting large number of results
getRange gets slower the more results it gets
m
Welcome back @erictgrubaugh
👋 3