tried creating a simple global variable, initializ...
# suitescript
a
tried creating a simple global variable, initialized as an object, and set within the
getInputData
stage, but its values are lost when i try to retrieve them in
reduce
n
In Netsuite the global variables are lost between entry points, I ended up using session objects / Script params / Ss1.0 Sched script with global var (to make it work faster) in the past. But, I think there must be some other way around this. Let me know if you find one.
a
@Nik looks like the N/cache module did the trick for me
n
Any noticeable slowness in the script, as in if the N/cache and script parameters take the same amount of time, I would go with the params, else N/cache would be my preference next time.
a
no idea, the script runs pretty quick though
n
Well, I had a lengthy process, I was running 2 searches, and one of them was supposed to be the input to other stages, whereas the other one was like a bunch of internal id(s) I wanted to assign them to, in a round robin fashion, so... There's that. I had that those internal id(s) stored as script parameter and would get at the begining of every reduce and set at the end of it.
N/cache should speed this up. Will test this tomorrow perhaps
a
it sounds like a good use case for it - my script is similar to what you're describing