# Tag Alarming - Expression

**URL:** <https://forum.inductiveautomation.com/t/tag-alarming-expression/51426>\
**Category:** Ignition\
**Tags:** ignition78\
**Created:** [September 29, 2021, 1:02am UTC](https://forum.inductiveautomation.com/t/tag-alarming-expression/51426 "2021-09-29T01:02:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelf](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@michaelf](https://forum.inductiveautomation.com/u/michaelf)\
**Post date:** [September 29, 2021, 1:02am UTC](https://forum.inductiveautomation.com/t/tag-alarming-expression/51426/1 "2021-09-29T01:02:49Z")

</div>

Hi there, I have an alarm to show display message when triggered:

left({itemPath},indexOf({itemPath},"/")) + " - " + substring({itemPath},indexOf({itemPath},"/F")+1,len({itemPath})) + " - " + {notes} + " - P" + {PlattenNo}

it works fine, however when I add if statement (below) the message displays the path to the tag instead.

if {PlattenNo} == 0:  
left({itemPath},indexOf({itemPath},"/")) + " - " + substring({itemPath},indexOf({itemPath},"/F")+1,len({itemPath})) + " - " + {notes} + " - P12"  
else:  
left({itemPath},indexOf({itemPath},"/")) + " - " + substring({itemPath},indexOf({itemPath},"/F")+1,len({itemPath})) + " - " + {notes} + " - P" + {PlattenNo}

PS: {PlattenNo} is Associated Data.

Appreciate,

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 29, 2021, 1:18am UTC](https://forum.inductiveautomation.com/t/tag-alarming-expression/51426/2 "2021-09-29T01:18:03Z")

</div>

You can’t use an `if` **statement** in an expression. You must use the expression language’s `if` **function**. Different syntax entirely.

[https://docs.inductiveautomation.com/display/DOC81/if](https://docs.inductiveautomation.com/display/DOC81/if)
