Google search is failing me. When loading a saved ...
# suitescript
r
Google search is failing me. When loading a saved search and running it (ex:
mysearch.run()
), is there any way to get a count of results without having to loop over each result and count by hand?
e
mysearch.runPaged().count
Uses 5 governance
r
can you loop over results afterwards without having to re-run a
.run()
or
.runPaged(...)
?
e
You could store the result of
runPaged
r
(reading NS Help article on
.runPaged()
, so looks that'll get me a summary, then if I want to get actual results, I can run
.fetch()
on the result. each of which costs 5 governance.
if I'm working with a limited subset of records (<50), and just want to know if more than 1 result is returned vs exactly 1, accounting for governance, would you think it'd be better to just run the search and count loops, or use 10 and
.runPaged()
then
.fetch()
aftewrads?
e
I would probably just use
run().getRange(0, 1000)
and then check the
length
on the resulting array
👍 1
b
performance-wise, probably no difference, goverance-wise. the paged option uses less points if there are no results
👍 1
r
thanks