Forum Discussion

JohnSnikers's avatar
JohnSnikers
Occasional Contributor
6 years ago

Autoincrementing project variables dinamically

Hi,

 

I would like to write a function in JS which automatically increments the value of the given project variable as parameter dinamically.

Something like:

function AutoIncrement(variable){
  Project.Variables.$set("VariableByName", variable, ++Project.Variables.$variable);
}

Im not sure how this Project.Variables.$set function works but I guess this is what I need.

I have used it before for setting some bool project variables to false without knowing there exact names.

Obviously it would work only with integers, but that's fine by me.

If possible please give me some examples of the use of $set.

 

Thanks

2 Replies