Passing List object as args to a runScript within an expression tag

Hi All,

I have a script definition that expects 2 arguments which are 2 lists.

  • def getGatewayStatus(listDatabaseNames, listDeviceNames):

When using script console, I can pass 2 lists to this definition and it provided a valid dataset return of all Gateway Status tags from System Tags.

I am trying to call this definition using an expression tag of data type dataset.
The expression keeps coming back with different errors. Using the following:

Any suggestion or help on how to construct this runScript statement?

What are the errors?


  • Post code, not pictures of code. That way we can copy and paste it into our answers. Use the </> code formatting button to preserve indentation and apply syntax highlighting.
  • For short snippets enclose the code in `` backticks.



will generate error:
"Syntax error on token: 'LEFT BRACKET' (line 1, char 55).

You can't construct lists as literals in expressions.
Depending on where you're executing this you can probably construct your lists as custom properties somewhere and bring them in as references.

1 Like

Instead of bringing back the result into a expression tag of type dataset, and then bind this tag to a table component, sounds like a better option is to run this script behind the scene and assign results directly to the data attribute of a Table component.

1 Like

You can with my latest Simulation Aids. See its asList() function.


You could also do something cheesy like make your script function accepts *args, then call the expression as runScript("script", 0, "arg1", "arg2", null, "arg3", "arg4") to separate the pairs of args.

Lots of ways to approach the problem - depends entirely on what you're comfortable with (and will be comfortable maintaining into the future).

1 Like