Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

Binary operator (Excel style IF)

  • Last UpdatedDec 06, 2023
  • 1 minute read

The binary operator is a special kind of assignment operator that is inspired by the Excel IF function.

Guidelines

  • It uses the syntax [?condition,trueValue,falseValue] and like its Excel counterpart, it accepts nesting.

  • By default, if no trueValue and falseValue are indicated, it assigns True and False values.

  • The binary operator condition clause must correspond to an unique operation returning a Boolean value (aVar.aField==aValue or true+false or true^true). It does not work as a condition used inside commands, routes, or IF nodes.

Code example

An example of a binary operator.

text=[?@item.selected@==true,The item is selected,The item is not selected]

value="[?[@dpiitem_[@current_dpi.value].value]==false]"

Workaround

When you must evaluate a condition made by different checks (IN and OR), use a workaround.

Transform the multiple checks into a single Boolean operation that embeds every check into another binary operator.

Incorrect example

[?@aNode.boolField@==true+@aNode.iValue@==3+@aNode.sValue==aText@,trueValue,falseValue]

Correct example

[?[?@aNode.boolField@==true]+[?@aNode.iValue@==3]+[?@aNode.sValue==aText@],trueValue,falseValue]

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in