Pipeline Expressions

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!

Try:

{displayPath} like "*LCBS*"

Regards,

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

Maybe try:

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,

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,

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?


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,

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

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.