# Expressions and Tag paths

**URL:** <https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648>\
**Category:** Ignition\
**Created:** [April 2, 2020, 11:04pm UTC](https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648 "2020-04-02T23:04:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnthonyF](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@AnthonyF](https://forum.inductiveautomation.com/u/AnthonyF)\
**Post date:** [April 2, 2020, 11:04pm UTC](https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648/1 "2020-04-02T23:04:53Z")

</div>

I am trying to pass strings containing tag paths to a template for an expression binding on a custom property but am getting this error on my IF statement: Error\_ExpressionEval("If function got a null first argument")

Code:

> If(  
> tag({StartStopPanel.PREQ01}) && tag({StartStopPanel.PREQ02}),  
> 3,  
> If(  
> tag({StartStopPanel.STT\_RUN}),  
> 1,  
> If(  
> tag({StartStopPanel.STP\_RUN}),  
> 2,  
> 0  
> )  
> )  
> )

So each of these strings contain something like [default]PLC/BoolTag

---

<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:** [April 3, 2020, 12:38am UTC](https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648/2 "2020-04-03T00:38:57Z")

</div>

Tag bindings of pretty much any kind get a null on startup while waiting for the subscription to deliver the first result. Where this is a problem, use the coalesce() or try() functions to transform that. Also, consider using indirect tag binding instead of the tag() function. See this:

> [@Nesting Not Allowed while using Properties in a Template to turn on a Light](http://forum.inductiveautomation.com/t/nesting-not-allowed-while-using-properties-in-a-template-to-turn-on-a-light/33609/16):
>
> Yes, there is. If the items that comprise your tagpath are updated, even if yielding the same result path, the entire expression containing the tag() function will have to execute. With indirect binding, this doesn’t happen. The strings themselves have to be reconstructed every time, even if not changing, slowing down the final expression execution. There are a few cases with computed gateway tags where the tag() expression is the only good way to do indirection, and the dynamic stuff above…

---

<div class="post-metadata">

**Author:** ![AnthonyF](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@AnthonyF](https://forum.inductiveautomation.com/u/AnthonyF)\
**Post date:** [April 3, 2020, 1:24am UTC](https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648/3 "2020-04-03T01:24:54Z")

</div>

Thanks. I’ve resolved it by creating custom properties for each tag and using an indirect binding on each property, then using these properties in the expression. Was this what you were pointing towards?

---

<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:** [April 3, 2020, 1:28am UTC](https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648/4 "2020-04-03T01:28:40Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Aswani](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@Gaurav\_Aswani](https://forum.inductiveautomation.com/u/Gaurav_Aswani)\
**Post date:** [November 19, 2024, 6:41pm UTC](https://forum.inductiveautomation.com/t/expressions-and-tag-paths/33648/5 "2024-11-19T18:41:15Z")

</div>

I was having a similar error IF FUNCTION GOT A NULL FIRST ARGUMENT, to resolve this I used COALESCE(evaluation expression,0) function to resolve it.

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