Setting up and using a global counter

Post Reply
netaware
Member
Posts: 35
Joined: Tue Jul 30, 2024 7:11 pm

Setting up and using a global counter

Post by netaware »

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() );
}
freddyp
Advanced member
Posts: 1189
Joined: Thu Feb 09, 2012 3:53 pm

Re: Setting up and using a global counter

Post by freddyp »

setGlobalData( scope : String, tag : String, value : String, persistent : Boolean )

The call expects 3 parameters, not 2 as in your code. The fourth one is optional.
netaware
Member
Posts: 35
Joined: Tue Jul 30, 2024 7:11 pm

Re: Setting up and using a global counter

Post by netaware »

Hello and thank you! i wasn't using scope!
Post Reply