I am writing a map/reduce script to search for a custom record and create a CSV file from its results. Firstly, in the getInputData() creating a search and returning its results. After that comes the map function where I am using JSON.parse to parse the result values.
I have an array declared globally as var data = '' in which I am pushing the values I get in map function.
But when all the looping ends in map() and it enters summarize(), the data array becomes empty again.
I want that data array to be called in summarize() where I can use file.create() function to create the csv file.
I used return data; in map() but it is showing as empty when in summarize().