# Pipeline Expressions

**URL:** <https://forum.inductiveautomation.com/t/pipeline-expressions/6393>\
**Category:** Ignition\
**Created:** [May 7, 2013, 5:18am UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393 "2013-05-07T05:18:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![allenr8](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@allenr8](https://forum.inductiveautomation.com/u/allenr8)\
**Post date:** [May 7, 2013, 5:18am UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/1 "2013-05-07T05:18:34Z")

</div>

I am trying to use the expression block to decide what roster should be called based on what facility an alarm originates from.

I have a simple expression like this: {displayPath}=“_LCBS_”

So any alarm that has LCBS in the path should evaluate true, but it keeps coming up false. Do I have some syntax problem I haven’t noticed?

Thanks!

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [May 7, 2013, 10:54pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/2 "2013-05-07T22:54:31Z")

</div>

Try:

```auto
{displayPath} like "*LCBS*"
```

Regards,

---

<div class="post-metadata">

**Author:** ![allenr8](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@allenr8](https://forum.inductiveautomation.com/u/allenr8)\
**Post date:** [May 24, 2013, 5:51pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/3 "2013-05-24T17:51:06Z")

</div>

What if I had a custom property named Phone that was a Boolean how should the expression look?

I have tried {Phone} = 1 and {Phone} = True to no avail.

Thanks

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [May 24, 2013, 8:26pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/4 "2013-05-24T20:26:51Z")

</div>

Maybe try:

```auto
toBoolean(coalesce({Phone},0))
```

The coalesce is just thrown in for good measure in case the property doesn’t exist. That expression worked for me when I just mocked it up.

Also, turning the logger “Alarming.Notification.Pipeline.BlockEvaluationContext” will help you see when the expression is evaluated, and what it results in… though it doesn’t give you much more than that.

Regards,

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [May 24, 2013, 8:28pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/5 "2013-05-24T20:28:30Z")

</div>

Though I should mention that in my test case, I just tried nothing more than just “{Phone}” as an expression, and it worked fine, both when the property was there and not.

How are you defining the Phone property on the alarm, is it an expression?

Regards,

---

<div class="post-metadata">

**Author:** ![allenr8](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@allenr8](https://forum.inductiveautomation.com/u/allenr8)\
**Post date:** [May 24, 2013, 8:31pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/6 "2013-05-24T20:31:38Z")

</div>

I did that originally as well. The two tags are defined as memory tags type Boolean. When I did \>0 there was an error in the console saying a type mismatch and that it was receiving a string.

I have a UDT with those two tags in them and the picture shown is how they are attached. Do I need a .Value afterwards?

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e87eae6544088e8fb7b868b8a1cdef9b9b313988.PNG)

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [May 24, 2013, 8:47pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/7 "2013-05-24T20:47:57Z")

</div>

No… I mock the same thing up and didn’t have a problem. Is there any message in the console when you save the tag about bindings not compiling?

I can understand the type error on “{Phone}\>0”, but if the tag is a bool, “Phone” alone should be fine, and in any case, “toBoolean({Phone})” should be a safe bet.

Are you sure it’s failing in the expression block? It can be a bit tricky to track down where things are going wrong in the pipelines… for example, I was just trying to test with a phone block set to “test mode”, but because I didn’t have any contacts with phone numbers, the test mode message wasn’t being printed out…

Regards,

---

<div class="post-metadata">

**Author:** ![allenr8](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@allenr8](https://forum.inductiveautomation.com/u/allenr8)\
**Post date:** [May 24, 2013, 9:01pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/8 "2013-05-24T21:01:55Z")

</div>

The toBoolean seemed to fix it. It wasn’t working with just plain Phone for me. Not sure why. It works now though!

---

<div class="post-metadata">

**Author:** ![wbaker](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wbaker/32/85315_2.png) [@wbaker](https://forum.inductiveautomation.com/u/wbaker)\
**Post date:** [August 28, 2022, 1:48pm UTC](https://forum.inductiveautomation.com/t/pipeline-expressions/6393/9 "2022-08-28T13:48:50Z")

</div>

Worth bringing this topic back, as my search results did not provide any recent solutions.

We needed to split to two Rosters without going back to the tags and adding new event attributes. The solution was to incorporate some way to check for a string in the event source path.

We learned that the Expression Block didn’t function like an Expression Binding in a regular session would.

1st Try - Failed  
`if(indexOf({source},"customstring")!=-1,true,false)`

2nd Try - Failed  
`'if(indexOf({source},"customstring")!=-1)`

3rd Try - Failed  
`indexOf({source},"customstring") != -1`

4th Try - Success  
`{source} like "*customstring*"`

I’m happy to have found this thread with the search feature and hope it can help others.
