In general, you use the phases of a M/R like so: 1...
# suitescript
e
In general, you use the phases of a M/R like so: 1)
getInputData
retrieves all necessary data from the database (usually via search), combines all relevant data into a single data structure, and returns that data structure 2)
map
[optional] receives the data and organizes it into groups (e.g. takes the Invoices returned by
getInputData
and groups them all by Customer) 3)
reduce
receives the data and performs the actual data processing (e.g. storing the data in an Item field in your case) 4)
summarize
[optional] contains statistics for all previous phases and can be used to send out summary reports or notifications that the processing is complete
d
Not sure I completely agree Eric, but very nice. A few things ... reduce is also [optional]. I'd characterize map as "An opportunity to process each result individually, with an opportunity to group with other results based on a key and send to the 'reduce' stage"
e
You must use one of
map
or `reduce`; personally I always use
reduce
, hence saying
map
is optional and
reduce
is not`. Yes, technically, you can use either
map
or
reduce