anyway around the 4000 results limit with the each...
# suitescript
c
anyway around the 4000 results limit with the each method? mySearch.run().each(function(result) {
s
I use a universal approach for processing search results such that my app code is focused on the business logic and not entangled with paging or counting results. It uses NFT and an example of code that processes all results until either completion or governance is exhausted looks something like this:
Copy code
Seq(LazySearch.load(searchid))
      .takeWhile(governanceRemains()))
      .map(nsSearchResult2obj())
      .forEach(r => loadAndCloseRMA(r))
the above takes RMA ids from a saved search and 'closes' them. Most of my scheduled scripts that are driven by some top level saved search look similar - just a few lines of code. Also notable the processing is 'lazy' in the sense that no matter how many steps you chain together, no intermediate collections are created (unlike lodash/underscore for example)