I have a Map/Reduce with the following but how wou...
# suitescript
n
I have a Map/Reduce with the following but how would I limit that to the first 5 results? function getInputData()         {             return search.load({'id': 'customsearch1385'});         }
s
switch to a scheduled script and only process the first 5
n
It needs to be a map/reduce, but it is such a large set or results that to test my code, i wanted just the first couple
e
I had this same request a while back; being able to do something like
Copy code
return {
  type: "search",
  id: "customsearch1385",
  limit: 5
};
would be amazing
It mostly got poo-pooed, but I think it would be great
n
dang, so no real option then in the map/reduce
m
can you add temporary criteria to the search to limit it? (ie: pick 5 internal ids or whatever etc)
e
Well, not with simply returning the search object
You can run the search within
getInputData
and
slice
the results
n
@mtsb might take this option and just limit the search for a couple tests. thanks
e
return search.load(...).run().getRange({start: 0, end: 5});
n
i'll try that to @erictgrubaugh
e
the other way is to edit your search and use a formula numeric field with rownum
🎖️ 3
👍 2
b
@ehcanadian Could you go into more detail on that? I just tried, but the search didn't like it.
e
message has been deleted
🎖️ 1
b
Wow, awesome. Thanks for that. I was trying it with curly braces. Is that even documented anywhere?
e
Yeah, I think so. I can't recall where I found it. SuiteAnswers probably