This is probably a really dumb question, but how d...
# suitescript
m
This is probably a really dumb question, but how do I pass an entire searchResult object to the map stage of a map/reduce script? I have a search that has a row for each line of a custom transaction. The map stage is wanting to process each row separately. Any thoughts on how to get the search into a regular object that i can work with?
s
Conceptually, you can just return your
search.create
from the
getInput
. If you want to process multiple lines from the same transaction together (but there are more than one transaction), then you can pass each individual line to
reduce
using the same transaction
internalid
as the
context.key
. Then just do your processing in reduce, not sure if that is what you are asking or not.
If you want to just manipulate/process the entire searchObject at once, I don't see why you would want to use M/R over Scheduled.
m
Ok thanks. Schedule was my other thought
I am passing a single transaction internal id to a task to offload the processing
t
are you using your reduce stage for other process? if not, you can write the context value from the map stage using a common key so that all result from the map stage would be grouped into that one key you are using