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
Hi,
> Im not sure how this Project.Variables.$set function works
https://support.smartbear.com/testcomplete/docs/reference/language/javascript/set-method.html
> If possible please give me some examples
Try this:
function AutoIncrement(variable){
Project.Variables.$set("VariableByName", variable, Project.Variables.$get("VariableByName", variable) + 1);
}