Expression Tag cannot execute runScript() using Gateway Scripting Project (Ignition 8.1.50)

Hi everyone,

I'm running Ignition 8.1.50 and I'm having trouble using a script function inside an Expression Tag.

Setup

  • I have a Gateway Scripting Project configured (a global project).

  • Inside that project, I created a script in project.Funcs_Util.

  • If I call the function through the Script Console, it works correctly.

  • The script simply returns a string.

Example:

def formatarTitulo():
return "Hello World"

What I'm trying to do

Inside a String Expression Tag, I'm trying to call the script like this:

runScript("project.Funcs_Util.formatarTitulo")

Problem

The Expression Tag shows the error Error_ExpressionEval and does not execute the script at all.

It looks like the Expression Tag can validate the syntax (Designer editor accepts it), but during runtime the script is not executed.

What I already checked

  • The Gateway Scripting Project is correctly set in Project Properties.

  • The script runs normally when called from:

    • Perspective Events

    • Tag Change Scripts

    • Script Console

  • Only the Expression Tag fails to execute runScript.

Question

Is runScript() supported inside Expression Tags in Ignition 8.1.50?
If not, what is the recommended approach to call shared project scripts from tags?

Should I move the logic to:

  • A Tag Change Script?

  • A Gateway Timer Script that writes to the tag?

  • A Tag Event Script?

Or is there any setting that allows Expression Tags to call Gateway scripts directly?

Any guidance would be appreciated!

Thanks in advance.

Use runScript sparingly, and only when the execution is in the single digit millis. Otherwise, you can stall other tags from running by blocking a tag execution thread.

It's far better to setup a gateway tag change, timer, or scheduled script to run the project script then write to the tag.

I can't debug why the script is not running without the code, but it probably has to do with scoping. I.E. trying to run a named query in the gateway scope without a project name provided.

1 Like

Have you saved the project? The designer script console will run unsaved scripts, but the gateway cannot.

You already confirmed with Perspective and Tag Change Events.

Look for entries in the gateway log.

Also what Daniel said about project name issues.

2 Likes