Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Why are different pa_script runs in the same variable scope?

jfuasid
Tera Contributor

I'm hoping someone can explain to me why the following is possible: when running a scheduled data collection, the pa script (for a breakdown mapping) is able to access variable values assigned in previous runs.


For instance, if you have the following code in your pa script...

 

var i;
if (!i) i = 1;
i++;

gs.info('record number '+i);

...i will increment with each record that is processed. 

 

Questions:

  1. Is this intended functionality?
  2. Can someone explain to me what is happening in the background with pa_scripts and scripted bd mappings that enables this?
  3. Is it safe to use this functionality to pass data (such as manual_breakdown sys_ids) between pa_script executions?

 

I would have expected each run to have its own variable scope.

0 REPLIES 0