runScript in Alarm Display Path dynamically

I am trying to use the runScript function in a tags Alarm DisplayPath dynamically.

runScript(“project.alarmDesc.alarmDesc(’” +{name}+ “’)”)

Basically the script being called grabs the alarm description from the database and would spit it back into the display path. {name} is the name of the tag, which is how it is linked in the database.

Any Ideas on why this isn’t working? It works like a charm in a text field. It wont even work hardcoded when I put it in the expression field for the alarm display path.

Thanks!

Shouldn’t {name} be {Name} ?

I have tried both name and Name. When you select it from alarm properties, it brings it in as {name}.

{Name} returns the entire tag path when I test it here.
Is your query setup to use that as criteria?

To see what it returns, just put it in the expression for Display Name and trigger an alarm.

You might need to do some parsing in your shared script to get it down to what you want to actually use as criteria in the query.

Try moving your script from project. to shared. :slight_smile:

Thank you both.

I had switched it to shared after the initial post (i saw on another thread that tags cannot reference project scripts).

I switched {name} to {itemName} as that is the string that I want to use.

Still no dice!