Hi All, In a map/reduce script I'm returning a su...
# suitescript
m
Hi All, In a map/reduce script I'm returning a summary saved search in the getInputData stage. In the map stage I'm loosing most of the columns, as NetSuite calls each of the columns
SUM(formulacurrency)
, e.g.:
Copy code
"SUM(formulacurrency)":"745.56"
and I have several similar colums The easiest solution for me would be to iterate through the search and set the labels as the key instead of
SUM(formulacurrency)
, however this way I'll loose the main advantage of M/R where I can directly return a saved search irrespective of the number of records. Any ideas?
s
I have used these two functions to make retrieving summary and join results easier from the Map phase of a map/reduce script. It should work quite similar to retrieving standard search results.
The code is compatible with SS 2.0 or 2.1, though you could modernize it quite a bit more if using 2.1
b
Netsuite's handling of duplicate formula columns is bugged in map/reduce
Try setting the name of your column to something unique, like formulacurrency_1
s
Oh, yeah, I hadn't noticed that this was a
formulacurrency
column. Using different suffixes is definitely required in that case. However, you can only customize the suffix if defining the saved search in code, so you will likely want to do that, and not load an existing saved search by id. Alternatively, you might be able to re-define this as a SuiteQL query, since Map/Reduce scripts support returning SuiteQL from getInputData. Handling the SuiteQL results in the map stage is quite different from a saved search, though.
b
you can load an existing search, but you basically have to replace all the formula columns with a slightly renamed copy