Runscript - Expression Binding on alarm displayPath

Hello guys,
running Ignition gateway 8.1.14.

Can anyone confirm a bug when trying to bind an expression to an alarm displaypath ??

shared script :
def GetAlarm(Id):

strQuery = "SELECT * FROM ALLARMI WHERE Id_Allarme = '" + str(Id) + "'"

Pds = system.db.runQuery(strQuery)
if Pds.getRowCount() >0:
	return (str(Pds.getValueAt(0, 'Description')))
else:
	return "Missing description for : " + str(Id)

expression in displayPath alarm binding:
runScript("shared.GetAlarm", "1")

I get an Error_expressionEval error ; the script works perfectly in the script console...

Is there any limitation to what I am trying to do or is it a bug ??
Thanks in advance,
Dominic

The "1" you supplied is interpreted as the poll rate and you are now missing the Id parameter.

Try:
runScript("shared.GetAlarm",5000, "1")

This will refresh every 5s.

https://docs.inductiveautomation.com/display/DOC81/runScript

no luck, still the same issue.

Did you specify the Gateway Scripting Project?

2 Likes

Can you str a string in python ? What's the actual error you're getting, that error message should contain more context. Try also passing in 1 as an integer

These are the screenshots of what i have implemented:
The error is generic, no other info.
p.s. : Sorry , the script should read runScript("shared.GetAlarm", 5000, "1")

image

Hi,
yes I gave the full path to the script ; as mentioned in previous post, the script runs perfectly in script console window.

Have you tried passing the function arg in as an int instead of a string?

1 Like

He asked about the Gateway Scripting Project
Project Library - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

The tags execute as the gateway, the script console as the project that is open.

Confirm that setting.

2 Likes

Well done guys!
I updated the Gateway Scripting Project parameter....
now working!

Cheers!