A simple script to turn milliseconds into time:
[attachment=4]Script Module Editor - app.test 2014.02.02 175135.jpg[/attachment]
Tests out as expected in Script Playground:
[attachment=3]Interactive Script Tester 2014.02.02 175223.jpg[/attachment]
Tag created to display script result:
[attachment=2]Tag Editor 2014.02.02 175411.jpg[/attachment]
[attachment=1]Tag Editor 2014.02.02 175419.jpg[/attachment]
But the tag gets a null value (evaluation error) instead:
[attachment=0]Ignition Designer 2014.02.02 181118.bmp.jpg[/attachment]
What am I missing here?
Right-click->Tag Diagnostics doesn’t give any useful information at all in this case:
[attachment=0]Tag Diagnostics.jpg[/attachment]
Tag Diagnostics does work as expected on another test expression tag the same as in original post above, except that its expression is simply:
now()
With some more testing, it seems like we get the same results with any expression tag (DateTime, Int4, and String all tested) using runScript as the expression (calling scripts returning datetime, 1, or ‘string’, respectively). Seems this can’t really be completely broken… I must be missing something simple. This is on Ignition 7.6.4 (b2013112117) | 32-bit.
Hi witman,
Here’s what you are missing: expression tags don’t belong to any one project; they are shared by all projects. app.* modules are specific to the projects they are defined in.
In an expression tag the runScript function doesn’t know which project’s app.mod.func to call, so it doesn’t call any of them.
I think this problem will be solved in Ignition 7.7 when global scripts are introduced. Global scripts are defined in one place and can be used by multiple projects so I would think they could be used in an expression tag’s runScript function.
You can still run one line Python scripts in expression tag runScript expressions, but referencing any app.* Python code doesn’t work.
Thanks nmudge; that makes sense. Global scripts will be a good thing. Meanwhile we can work around this by putting the runScript in an expression binding on a component’s property (instead of in an expression tag).
Do event scripts (client) have this problem also? I seem unable to call a predefined script in a module.
No, event scripts do not have this problem. Something else must be the problem.