Here is a little more detail. Maybe that will help.
So we have tag folders in a structure like:
MDF/M101/
MDF/M102/
and so on...
In each of these folders there are several tags. Up to 9 of those tags have alarms configured. Those will be tags like:
MDF_101_Low_Voltage
MDF_101_Port_Error
MDF_101_Motor_Jam
MDF_101_Thermal_Error
Etc...
The display path for each alarm is configured with the tag name as part of that in order to identify the specific Motor and Alarm.
Hence all the folder tags will be different from folder to folder. With roughly 500 or so of these you can see how configuring the expression tag with the individual folder alarm tags would be a daunting task.
I'm sure it is possible to use the system.alarm.queryStatus in a fashion like this.
I have used it in the Script Console and passed it a wildcarded tag path with the required states and it works fine.
The problem I get in the UDT Expression Tag is the following:
The tag's expressing is:
if(runScript("project.MDF.alarmStatus", 0, {PathToParentFolder})=True,1,0)
The "project.MDF.alarmStatus" consists of the following:
def alarmStatus(tagFolder):
alarmQRes = system.alarm.queryStatus(path = ["'*" + tagFolder + "*'"], state = ["ActiveUnacked", "ActiveAcked"])
numAlarms = len(alarmQRes)
if numAlarms > 0:
return True
else:
return False
so the script takes the tag's parent folder in and should return True/False depending on if there are any Acktive alarms, whether acknowledged or not.
What I actually get is a the expression tag gets the little red square with white "x". When I look at the Tag Diagnostics for the expression tag I see this:
"Error configuring tag for execution. Error:
Syntax Error on Token: 'DIVIDE' (Line 1 , Char 47)"
The expression code looks like this:
if(runScript("project.MDF.alarmStatus", 0, {PathToParentFolder})=True,1,0)
Counting over 47 characters puts the "offending" syntax at around the "th" in PathToParentFolder.
No matter what I have tried I keep getting this same kind of error.
Any help point out where I'm going wrong and what I need to do to change this would be appreciated!
Mike