Passing Tagpath in Tag expression

Hello again!

I am trying to make my values turn red if any of my alarm tags are = 1, I know how to do the transform part to actually make it change colors, I just can’t get the If statement to show a value. I am not sure if I have a syntax issue or the way I referenced my tagpath is incorrect?

Move your expression from a Tag expression, to just an expression. Also, you don't need the if statement, just ORing them together should be enough.

Your current expression has an extra 1 in there.

getting this error

You are missing a comma by the first 1 now.

It's generally easier to get good advice when you paste in expression and scripts instead of screenshots.

You need to either add the IF back to the start (since you have the then/else values at the end) or remove all the IF related stuff, and just have the 2 OR'd values, which will return a boolean without being in an IF.

Added the If back to front and that fixed it. Thanks for the help guys!
if({view.params.TagPath.Alarms.Alm_H}|| {view.params.TagPath.Alarms.Alm_HH} || {view.params.TagPath.Alarms.Alm_L} || {view.params.TagPath.Alarms.Alm_LL},1,0)

The alternative without the IF would have been this:

{view.params.TagPath.Alarms.Alm_H} || {view.params.TagPath.Alarms.Alm_HH} || {view.params.TagPath.Alarms.Alm_L} || {view.params.TagPath.Alarms.Alm_LL}
2 Likes

This also worked for me too. Thank you.

Just a question to clarify. Your expression looks like you're taking the current value of each alarm passed through as a parameter rather than the tagpath string for the alarms. Depending on how your views are configured sometimes parameters won't properly pass value changes after the view is already opened. So be mindful of that.

If your tags are all together in one UDT then you may want to consider switching to just using an indirect tag binding pointed to the tag's AlarmMetrics, likely the .HasActive

2 Likes