Hello community,
is it possible to set/change the value of a process variable in a scripttask/expression for example when a condition is true other than node output is stored as.
I know how to set a value of a processvariable in the node output, but can it be done in like setting the value of a localvariable?example:if(pv!fruit="Apple",pv!color:"green","")
Kind Regars,
Erik
Discussion posts and replies are publicly visible
I guess it depends on what exactly you want to do. If you want to set the value of pv!color to "green" when fruit is "apple", but otherwise not change the value of pv!color, you would simply set the following expression in your script task to save into pv!color:
if( pv!fruit = "Apple", "green", pv!color )
Thank you Mike.I wanted to know if it was possible not use the node outputs to make it more dynamic.The Apple and colors was an example to illustrate my question.
Kind Regards,
Can you give a bit more clarification as to what you're trying to accomplish, then?
Hello Mike,
What I am trying to accomplish is to set the value of multiple pv's based on the value of 1 other pv. Then the values of the multiple pv's will be used/configured in the doc from template service. No I configured one expression for each pv separately in the nodeouput of a scriptask to save the value. So wanted to know if it is possible to update all the pv's in one expression.
Ah i see. No, the way you've done it is the correct way. I've wished at times for the ability to update multiple PVs based on one expression (such as an expression that runs an expensive calculation, and i want to just run it once and save various aspects of the result to different PVs). The only real alternative here is to run the expensive operation in an input variable (which sucks since input variable expressions STILL collapse the expression code they contain down to one line, upon saving...), then refer to that ACP in the different output expressions. But even this still does require one output entry added for each PV you want to write into.