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

AVEVA™ Gateways

Add IF and FOR EACH Statements

  • Last UpdatedOct 24, 2024
  • 3 minute read

You can specify IF and FOR EACH statements to fine-tune your configuration.

Note: The drag-and-drop feature is currently not supported for IF and FOR EACH statements.

Adding IF Conditions

If you want to specify any conditions based on which the objects and their attributes must be exported, you can do so by adding an IF condition.

To add an IF condition:

  1. On the Models tab, click Class Mappings.

  2. Select the required class from the class list. The mappings for the class, if any, are displayed in the EIWM Object Mapping area on the EIWM tab.

  3. In the EIWM Object Mapping area, do one of the following:

    • If you want to add the condition to the attributes of an object, select the root of the object tree for which you want to add the condition, right-click and select Add control > If Condition.

    • If you want to add the condition on the objects, right-click anywhere on the empty space in the EIWM Object Mapping area, and select Add If Condition.

      The IF condition is added to the tree and the area to add the condition appears.

  4. Click the Add icon. The PML Condition Expression box appears.

  5. Type the condition in the box. An example condition is as follows: NAME eq 'TRA001-RECT'

  6. After providing the condition, to specify what needs to be done when the condition is met, add a member to the If statement. To do this, in the EIWM Object Mapping area, select If, right-click and select Add EIWM, and then select the attribute that you want to add. For information on how to add attributes, see Add Attributes to Classes.

  7. If you want to specify what needs to be done when the condition is not met, you must add an Else member to If. To do this, select If, right-click and select Add control > Else.

  8. After adding the Else member, select Else, right-click and select Add EIWM, and then select the attribute that you want to add. An example IF condition is as follows:

    Note: You can also add nested conditions using IF-ELSE IF, IF-IF-ELSE IF, IF-FOR EACH-ELSE and so on. You can also use regular expressions to add these conditions.

Adding FOR EACH Statements

A FOR EACH statement enables you to specify the actions to be taken for every ARRAY item of an attribute or PML expression (which returns an ARRAY result).

To add a FOR EACH condition:

  1. On the Models tab, click Class Mappings.

  2. Select the required class from the class list. The mappings for the class, if any, are displayed in the EIWM Object Mapping area on the EIWM tab.

  3. In the EIWM Object Mapping area, select the root of the object tree for which you want to add a FOR EACH condition, right-click and select Add control > For Each. The For Each condition is added to the object tree and the Variable name and PML expression with array result areas appear.

    1. Enter a variable name in the Variable name box.

      Note: The variable name must only contain alphabets, numbers and an underscore ("_").

    2. Enter a PML expression that results an array of values in the PML expression with array result box. The FOR EACH condition is added.

      An example FOR EACH condition is as follows:

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