Super weird issue today. I have a M/R that on getI...
# suitescript
b
Super weird issue today. I have a M/R that on getInputData was returning an Object of Objects, Eg: { x: {xx:xxx}, y{yyyyy} } and passing that to the reduce stage and for some unknown reason the reduce step wasn't being triggered at all, the script didn't even trigger the summarize stage, it was going straight to Completed status. I tried replicating the same issue in Sandbox and I couldn't. I had to turn the Object of Objects into an Array of Objects in order for it to work in Production, Eg: [ {xx:xxx}, {yy:yyy} ] Moreover, I already have other scripts returning an Object of Objects in Production and they are working fine. I am puzzled.
n
The first thing that comes to mind, make sure you are returning the reduce and summarize stage out of your script.
a
As I said many many many times before, I don’t care what a half-baked SuiteAnswers say. From a software engineering / design perspective, if theres is an API with defined methods (result.getValue(), etc) there is no reason to return a raw object. The MR scripts I wrote in the last 8 years, never ever return a raw search object or raw result object, and I never/ever had a single issue. The day somebody decide to change the underlaying object structure of a search result or search result object, they would have to also update the API method and that is enough for my code to never / ever break.
b
@alien4u what does that have to do with my issue?
a
Nothing and everything. When you return an array of objects it works properly, If you are returning objects pairs and that is documented in the SuiteScript API(then it have nothing to do with your issue).
😂 1
The point I’m trying to make is, Map Reduces are not a NetSuite thing (https://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf) They are just an implementation of something already described and well-known, and they were designed to handled arrays of data(whatever that data is).
Again my apologies… somebody else would know better why objects of objects fail, I do not know, I always stick to arrays of (whatever)…