RunScript in expression

Hello,
Ok I suppose I’m cursed by runScript. I always have trouble to make it work.

I’m calling this function in a script and it’s working fine:
val = TagScript.Downtime.ScadaStateToDowntimeReason(600, 10, ‘Winder’)
print str(val)

Now I try to call the same script in an expression tag and I cannot make it work. Here the expression:
runScript(“TagScript.Downtime.ScadaStateToDowntimeReason”,600,10,“Winder”)
… and I get Error_ExpressionEval.

Can someone help me please?

Thanks.

You didn’t use the pollRate argument. It should be
runScript("TagScript.Downtime.ScadaStateToDowntimeReason",0,600,10,"Winder")

Script called from the gateway scope (on expression tags, for example) also have to be in the Gateway Scripting Project, so if TagScript.Downtime.ScadaStateToDowntimeReason isn’t there, you can’t call it from an expression tag.

3 Likes