Using UDT parameters in Alarms Expressions

I cannot get my UDT parameters to work in an alarm expression. I believe the problem is with both Display Path and Custom Message. My work around with a Custom Message was to not make an expression, but just put the references in the field like I was typing static text. Display Path will show a UDT parameter if I select that option, but if I try to insert it in the expression, I get an error. What’s weird is that it will work with a default parameter.

Here’s what I’ve tried:
Error: {FuncDesc} + " - " + {[.]HourSPT} + “hours”
Error: concat({FuncDesc}," - “,{[.]HourSPT},“hours”)
No Error: concat({InstanceName},” - ",{[.]HourSPT},“hours”)
No Error: {InstanceName} + " - " + {[.]HourSPT} + “hours”

Error message: displayPath Syntax Error on Token: ‘LONG CONST’ (Line 1 , Char 7) ERROR

My UDT is in UDT which is in UDT.

What am I missing here? Is this a known issue or a me issue?

Please advise. Thanks.

System: 7.8.5

Try putting the UDT parameters inside double quotes, as in:

"{FuncDesc} - " + {[.]HourSPT} + " hours"

UDT (and alarm) parameters in expressions are evaluated in a different order than property or tag bindings, so they need to be inside actual strings.

1 Like

Excellent! That worked. I did see that option on other posts and I did try it, but I assumed I did not see the error anymore simply because it was now a string. I also did not have a high confidence since {InstanceName} was fine.

Very odd way of having to configure it, but at least now it works. Thanks a lot Griffith!

Was just struggling with this today! Very frustrating that some parameters need quotes and others don’t. Need better documentation on what needs what and why.

Agreed, it can be confusing, but the main culprit are UDT parameters: long story short, if the reference is a UDT parameter, wrap it in quotes, regardless of datatype.

As for documentation, we actually have a page covering this, but it sounds like it isn’t easy to find…we’ll have to improve that: https://docs.inductiveautomation.com/display/DOC79/Data+Type+Parameters+in+Expressions

1 Like

Ah that is a good page! Don’t think i’ve ever come across it before though.

In 7.9.4-beta1, in alarm Associated Data, expression or binding to UDT String parameter are replaced by the value of the parameter instead of {myParameter} when applying the change in the Data type Strcuture configuration !??? :thinking:

After Apply:

@Paul.Scott is it the expected behavior for expression in associated data???

@mazeyrat That doesn’t look quite right. I’ll notify QA here so we can take a look.