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

AVEVA™ XR Studio

Switch operator

  • Last UpdatedDec 06, 2023
  • 1 minute read

The switch operator enables you to perform conditional assignments on the base of a parameter value.

Guidelines

  • The syntax is [:conditionField,case0:value0,case1:value1…,default:defaultValue].

  • The conditionField is the switch argument. The operator returns one of the values depending on the value of the conditionField.

  • If conditionField matches one of the specified cases, the operator returns the relative value.

  • If conditionField doesn't match any of the cases, the returned value is the default one.

  • If no default is specified, the operator returns "".

  • Like other operators with rectangular brackets, the switch also supports nesting.

Code example

An example of a switch operator.

text=[:@knobXX.value@,0:OFF,1:MANUAL,2:AUTOMATIC]

value="[:@varSelectedItem@,V52001:1,V52002:2,default:0]"

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