Expression Alarm evaluating two tags

I need to create an alarm that evaluates two tags to activate the alarm. The first tag I have is LineRunning and is Boolean value based on if the encoder is moving or not.

The second tag is Operator and is a string value based on who the operator is that is on the machine and logged in to Ignition.

The tag I want to create evaluates the LineRunning tag value, if it is true and the Operator tag is blank I need to have an alarm that is triggered.

Operator Tag

Line Speed Tag

The tag that I created is an expression tag

with the following expression

But I'm getting an Error_Configuration value returned

Does anyone have any suggestions to make this work?

If your expression tag is in the same level of the UDT as your other two tags (it probably should be) you can just write that expression as:
isNull({[.]Operator}) && {[.]LineRunning]}

There's no need for an if statement that returns true and false respectively, and you can use the "local" syntax (leading [.]) to refer to the local folder to make referencing the other tags easier.

1 Like

You forgot a parenthesis:
isNull{... should be isNull({...

But you can remove the if altogether.

2 Likes

Thank you that worked!

The only issue I'm running into now is that the argument is coming back false because there is an operator listed but the press isn't running. That is actually not when I want the alarm. I only want the alarm to trigger when there is no operator AND the press is running. How should I change the expression to cover that scenario?

Tip: post code, not pictures of code. Anyone wanting to answer your question and modify your expression has to type it all out by hand (or use OCR). Note that Expression Language will tolerate line breaks and tabs so you can wrap your expressions for readabiilty.

if(
    condition,
    "What to return if true",
    "What to return if false"
)

See also, Wiki - how to post code on this forum

I'm guessing the Operator tag is actually an empty string, rather than an explicit null.
Try:
{[.]Operator} = "" && {[.]LineRunning]}

2 Likes