Above is my sample code with contents as global va...
# suitescript
r
Above is my sample code with contents as global variable, at what point or in which function should i create csv file.
n
You don't have globals in M/R. or even in any other script where you have different entry points running at different time. In my past, I dealt with this using a Script Parameters that I was setting with an array and using it again and again in my reduce. But I think N/cache module should do it better.
s
as a side note, if you were using ES2015+ I think you could have
Copy code
return {
getInputData,
map,
reduce,
summarize
}
and hence avoid repeating yourself