OR Statements With Expression Tags

Just wanted to explain a solution to a problem I was having with expression tags since I didn't already see a post on here>

Let's say you have a group of tags that represent a group of conveyor lines, such as Conveyor1, Conveyor2, etc, and you want to be able to monitor if any of the conveyor lines is faulted. Instead of looking at each individual tag, you want to use one master tag, such as Any_Conveyor_Faulted.

Here is how you would do this:
Create new expression tag > data type is boolean, execution mode is event driven. Under expression, use this:
{[~]FOLDER NAME/TAG_NAME.value} || {[~]FOLDER NAME/TAG_NAME.value}

Each tag path needs {} around it, and do not forget the .value at the end, or it does not work. Since ignition uses jython, the "or" and "OR" expressions from python do not appear to work, so using || is a good work around.

Hope this helped someone.

Welcome to the forum, Christopher. A couple of points:

Ignition uses Jython for scripting. Your
{[~]FOLDER NAME/TAG_NAME.value} || {[~]FOLDER NAME/TAG_NAME.value}
is an expression and follows the documented rules for Expression Language and Syntax | Ignition User Manual (where you will find the logical OR syntax documented). You can think of Ignition's expression language as being like a spreadsheet's functions.

Expressions often involve one or more other values that are used to calculate a final value. In most cases, expressions only return a value.

In Excel you would use VBA (Visual Basic for Applications) for scripting and in Ignition it would be Jython.

For posting code here, please see Wiki - how to post code on this forum.

1 Like

You do not need the .value as the value property is the default property. Just including the the tag path is enough as it will resolve to the value of the tag.

1 Like