# Expression Alarm evaluating two tags

**URL:** <https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [January 12, 2024, 3:40pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199 "2024-01-12T15:40:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brett\_Eidahl](https://avatars.discourse-cdn.com/v4/letter/b/c68b51/32.png) [@Brett\_Eidahl](https://forum.inductiveautomation.com/u/Brett_Eidahl)\
**Post date:** [January 12, 2024, 3:40pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199/1 "2024-01-12T15:40:59Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6fe929b2854d8b2689720a93e9deb0c692f82e56.png)

Line Speed Tag

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/b/9be19b969cca91a65fda915ba52247d974555a46.png)

The tag that I created is an expression tag

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1ac4f5dcd58b5c994a60f4c90cc6f1db53dfb21e.png)

with the following expression

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/5/f5bbf432a13d4de39b2e31467dd062b4290395e4.png)

But I'm getting an Error\_Configuration value returned

Does anyone have any suggestions to make this work?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 12, 2024, 4:55pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199/2 "2024-01-12T16:55:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [January 12, 2024, 5:00pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199/3 "2024-01-12T17:00:01Z")

</div>

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

But you can remove the `if` altogether.

---

<div class="post-metadata">

**Author:** ![Brett\_Eidahl](https://avatars.discourse-cdn.com/v4/letter/b/c68b51/32.png) [@Brett\_Eidahl](https://forum.inductiveautomation.com/u/Brett_Eidahl)\
**Post date:** [January 12, 2024, 8:19pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199/4 "2024-01-12T20:19:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 12, 2024, 8:53pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199/5 "2024-01-12T20:53:31Z")

</div>

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.

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

```

See also, [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 12, 2024, 9:16pm UTC](https://forum.inductiveautomation.com/t/expression-alarm-evaluating-two-tags/84199/6 "2024-01-12T21:16:35Z")

</div>

> [@Brett\_Eidahl](#):
>
> I only want the alarm to trigger when there is no operator AND the press is running

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