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

AVEVA™ XR Studio

if (command)

  • Last UpdatedNov 05, 2023
  • 2 minute read

The if statement is evaluated at command execution time. The engine script supports If conditions inside commands.

Note: This is different than the if (pre-process) node, which is evaluated during script loading. The syntax for if (command) is also different.

Platform support

This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Else and conditional else

The if statement supports multiple conditional else statements.

When the if condition is not verified, all else statements defined inside are evaluated in order. The first else clause whose condition is verified is executed.

Position

The if statement can be only inside a Command node node.

Code example

This is a code example for if command.

<command name="check_dpi">

<!--...-->

<!-- SIMPLE IF-->

<if condition="@missione@==0">

<setfield field="check_single.execute" value="0,true"/>

<setfield field="check_single.execute" value="1,true"/>

</if>

<!-- IF ELSE-->

<if condition="@missione@==0">

<setfield field="check_single.execute" value="0,true"/>

<setfield field="check_single.execute" value="1,true"/>

<else> <setfield field="check_single.execute" value="0,false"/>

<setfield field="check_single.execute" value="1,false"/>

</else>

</if>

<!-- IF ELSEIF -->

<if condition="@missione@==0">

<setfield field="check_single.execute" value="0,true"/>

<setfield field="check_single.execute" value="1,true"/>

<else condition="@missione@==1">

<setfield field="check_single.execute" value="0,false"/>

<setfield field="check_single.execute" value="1,false"/>

</else>

<else condition="@missione@==2">

<setfield field="check_single.execute" value="0,true"/>

<setfield field="check_single.execute" value="1,false"/>

</else>

<else>

<setfield field="check_single.execute" value="0,false"/>

<setfield field="check_single.execute" value="1,true"/>

</else>

</if>

</command>

Fields

These are the fields for if (command) statement.

Both if and else tags have only a condition field.

Fields

Type

Use

Default value

Description

condition

sstring

Optional

No default value

Applies a condition to the parameter value assignment.

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