Answered question

JavaScript action changeValue - how to set the value?

I see the two methods setValue() and changeValue() on context.variableManager.

With setValue I can specify the variable and the value to set, like context.variableManager.setValue("newVar", "new value");

But changeValue has only 1 parameter: changeValue(String variableName)

How do I tell the method to which value I want change the specified variable?

Roland D.
Roland D.

Roland D.

Level
0
40 / 100
points
Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

You can't specific which value you would like. This method will force the variable to jump to the next raw of your variable despite the default change policy.

So if based on your variable policy row n is currently what the users are using this changeValue method will force the variable to jump to row n+1

You have exactly the same behavior by using the logical action "Variable modifier"

Did you find this useful ?

No (0)

Yes (0)

0% of users found this answer useful

Other answers

Roland D.
Roland D.

Roland D.

Level
0
40 / 100
points

Hi Nouredine,
now its clear, i had the false assumption that you should use setValue(var, val) to create and fill this new variable, and use changeValue(var, ...) to update an existing variable.

In the documentation for setValue() it reads: "When using the name of a declared variable, a runtime variable will be created that will override the declared variable. Overriding declared variables is not recommended." And if overriding is not recommended, i use changeValue() for updating the vars value.

So I assume, you should ALWAYS generate a new variable, and dont use setValue() on an existing variable. But I really dont understand, why overriding is not recommended. If the old variable is no longer reachable, where is the problem?