Setting up and using a global counter
Posted: Thu May 21, 2026 4:58 pm
Hello,
I want to setup a global counter, so when the counter hits specific number, i want to send email (problems jobs for testing).
But it keeps failing when it gets to the line to set the global data.
It fails at the "s.setGlobalData("myCounter", counter.toString());"
Anu ideas why?
This is a sample of my script:
var counter = parseInt(s.getGlobalData("myCounter", "0"));
counter++;
s.setGlobalData("myCounter", counter.toString());
If (counter === 10){
job.sendToData(3, job.getPath() );
}
I want to setup a global counter, so when the counter hits specific number, i want to send email (problems jobs for testing).
But it keeps failing when it gets to the line to set the global data.
It fails at the "s.setGlobalData("myCounter", counter.toString());"
Anu ideas why?
This is a sample of my script:
var counter = parseInt(s.getGlobalData("myCounter", "0"));
counter++;
s.setGlobalData("myCounter", counter.toString());
If (counter === 10){
job.sendToData(3, job.getPath() );
}