# Tag syntax help

**URL:** <https://forum.inductiveautomation.com/t/tag-syntax-help/74385>\
**Category:** Ignition\
**Created:** [May 31, 2023, 6:56pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385 "2023-05-31T18:56:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan\_mueller](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dan\_mueller](https://forum.inductiveautomation.com/u/dan_mueller)\
**Post date:** [May 31, 2023, 6:56pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/1 "2023-05-31T18:56:11Z")

</div>

Need help in creating a tag that has this syntax  
if (part\_number = '32013-03',y\_limit = 20,y\_limit = 0)

---

<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:** [May 31, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/2 "2023-05-31T19:00:13Z")

</div>

So, expression tag? It would be something like this:

```auto
if({path/to/part_number}='32013-03', 20, 0)

```

Where the name of the tag would presumably be `y_limit`.

(Expressions cannot perform assignments internally--their **result** is assigned to a tag or to a bound property.)

---

<div class="post-metadata">

**Author:** ![dan\_mueller](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dan\_mueller](https://forum.inductiveautomation.com/u/dan_mueller)\
**Post date:** [May 31, 2023, 7:33pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/3 "2023-05-31T19:33:49Z")

</div>

part\_number is an OPC string tag in my project so, my syntax for tag Y\_limit below  
If ( part\_number = "32013-03",20,0 gives me an error\_configuration...still missing something

---

<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:** [May 31, 2023, 7:36pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/4 "2023-05-31T19:36:11Z")

</div>

The braces around the path to part number tag are required. The part I showed in my example that is between the braces is the only part of my example that isn't to be used verbatim.

---

<div class="post-metadata">

**Author:** ![dan\_mueller](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dan\_mueller](https://forum.inductiveautomation.com/u/dan_mueller)\
**Post date:** [May 31, 2023, 7:57pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/5 "2023-05-31T19:57:36Z")

</div>

I want this expression to return a value of 20, instead it returned a 0  
if ({[Cast Iron]IC\_grinding/Part\_number} ='32013-03', 20, 0)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5c45513c8ce84f3708b2aa66db8f82437ae20aeb.png)

---

<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:** [May 31, 2023, 8:00pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/6 "2023-05-31T20:00:29Z")

</div>

Looks like your part number has spaces. You either need to match them in the comparison or trim them in the source data.

Also, since the two tags are in the same folder, you can use the "same folder" provider notation to simplify your expression. Like so:

```auto
if({[.]Part_number}='32013-03', 20, 0)

```

---

<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:** [May 31, 2023, 8:01pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/7 "2023-05-31T20:01:20Z")

</div>

![Tag string spaces](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/e/eea479927132860fc66a9077ae32729fd15472c9.png)  
I was about to say the same thing.

---

<div class="post-metadata">

**Author:** ![dan\_mueller](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dan\_mueller](https://forum.inductiveautomation.com/u/dan_mueller)\
**Post date:** [May 31, 2023, 8:08pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/8 "2023-05-31T20:08:55Z")

</div>

changed the length to 8 of the string tag in the plc and it worked fine....thanks for your help

---

<div class="post-metadata">

**Author:** ![dan\_mueller](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dan\_mueller](https://forum.inductiveautomation.com/u/dan_mueller)\
**Post date:** [May 31, 2023, 8:20pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/9 "2023-05-31T20:20:31Z")

</div>

odd question, how would the syntax look if I wanted to check the part\_number against multiple values? If ({[.]part\_number} ='32013-03'||'32013-02'||'32013-01',20,0)

---

<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:** [May 31, 2023, 8:23pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/10 "2023-05-31T20:23:40Z")

</div>

```auto
case({[.]part_number},
    '32013-03', 20,
    '32013-02', 20,
    '32013-01', 20
    ,0
)

```

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

---

<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:** [May 31, 2023, 8:25pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/11 "2023-05-31T20:25:53Z")

</div>

If you don't want to use `case()`, you'd need to spell out each comparison between the `||` operations. Or'ing the values is not a shortcut for or'ing the comparisons.

FWIW, I hate the fixed nature of `case()`. I tend to put the values in a dataset and use `lookup()`.

---

<div class="post-metadata">

**Author:** ![dan\_mueller](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dan\_mueller](https://forum.inductiveautomation.com/u/dan_mueller)\
**Post date:** [May 31, 2023, 9:59pm UTC](https://forum.inductiveautomation.com/t/tag-syntax-help/74385/12 "2023-05-31T21:59:55Z")

</div>

I think I will set a bool in the HMI and just change Y\_limit in Ignition. I will need only two tags to set the y-axis max limit
