I have a system script i am calling from a Template. i have a parameter in the Tempalate that contains some path information the script needs. this will be set differently everytime the template is used.
I can not figure out how to pass the parameter value in the runScript call? if i just hard code it as a string it works fine. But as soon as i use the parameter, even though it has the same value as the string, i get a syntax error.
Thanks for any help.
What is the datatype of the parameter that you are passing to the script? It it coming from a UDT?
No, not from a UDT ( I dont think).
it is just a string value entered in a custom property parameter. All i am doing is trying to determine is different sub systems have active alarms by using the system.alert.queryAlertStatus().
Here is the Module Defiition:
def SystemActiveAlerts(System,UnAck, Ack ):
import system
return system.alert.queryAlertStatus(path=System, activeAndUnacked=UnAck, activeAndAcked=Ack).rowCount
Here is my call, which works, where ‘CA3/PCW/’ is a path filter:
runScript("app.alert.SystemActiveAlerts('CA3/PCW/’, 1, 1)", 5000)
Here is the call that does not work substituting the string above with the same string in a custom property, where Status.System containes CA3/PCW/*:
runScript(“app.alert.SystemActiveAlerts({Status.System}, 1, 1)”, 5000)
This results in a Syntax error.
Thanks,
I think your call is literally passing in the text “{Status.System}” as the first parameter.
Does this work for you?
runScript("app.alert.SystemActiveAlerts(" + toStr({Status.System}) + ", 1, 1)", 5000)
Dan
no luck.
with it in quotes like that seems like it is literally sending + toStr({Status.System}) +, tried without the quotes and the + and still no joy.
Thanks,
In what scope is this expression being run from, an expression tag? Property binding?
Also, what component is the custom property part of? A root container, or a component within the container?
Not sure i fully understand the question, but will try.
This is on a template.
I have an internal Property defined as an integer called “Acitve”
I have a Template Parameter defined as a String called “System”
Active is linked to an Expresion, the expresion equals:
runScript(“app.alert.SystemActiveAlerts({Status.System}, 1, 1)”, 5000)
System has a string entered into it of:
CA3/PCW/*
Have also tried:
‘CA3/PCW/*’
both result in a syntax error.
If i replace {Status.System}, wtih ‘CA3/PCW/*’ in the expresion, the expresion then works.
Thanks,
Oops forgot, both parameters (System and Active) are defined on the root container.
Ok, thanks for clearing that up, I think I was getting something confused.
Try using concat():
runScript(concat("app.alert.SystemActiveAlerts('",{Status.System},"', 1, 1)"),5000)
The single quotes around your string that your sending to SystemActiveAlerts should fix the syntax error, if not, can you post the full syntax error? Thanks.
That did it!
Now all i have to do, is read up on Concat so I can figure out why.
Thanks for the help.
Using the concatentation opeators (+) should’ve worked too, it sounds like those single quotes were the missing piece. Glad you got it working.