Error on Expression Tag, runScript not working

Recently one of the developers on my team reported a potential issue with an Expression Tag running a project scripting function.

I have tried this on version 7.9.12 and 8.0.6, and both show the following for Quality on the Tag:

7.9.12: Evaluation Error
8.0.6: Error_ExpressionEval(“Error executing script for runScript() expression:scales.test”)

Additionally on 8.0.6 the “Last published value” of the Tag under Diagnostics has the following value:
[null, Error_ExpressionEval(“Error executing script for runScript() expression:scales.test”), Wed Jan 08 21:44:30 CET 2020 (1578516270254)

The test function looks like this:

def test():
    return True

Binding that function to a Check Box’s Selected property works fine, but binding to an Expression Tag does not.

What are we missing?

Thanks.

Where’s the script defined? An expression tag does not belong to a project, so in 7.9 you’d have to define it in the global area, and in 8.0.6 you’d have to define it in whatever project has been designated as the “Gateway Scripting Project” in the gateway settings.

1 Like

Oh!

I had forgotten about that entirely.

Thanks, Kevin!

How should we call the test function of the Gateway Scripting Project from another project?

Thanks again.

In 8.0 you can only do that if the other project inherits from the Gateway Scripting Project.

On an upgrade the default setup is that we move all the old globally scoped stuff to an inheritable project called “global” and then make all your other projects inherit from “global” by default.

An upgrade should also set the Gateway Scripting Project to this “global” project.

1 Like