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

AVEVA™ Work Tasks

Decision: Decisions

  • Last UpdatedJun 21, 2024
  • 5 minute read

You can create conditions for the decision action in this property window. To open this window, click the edit button for the 'Decisions' property. The following window shows the Decision property window:

This Decision window has the following controls to specify the condition for a rule:

  • Add Rule: Click Add Rule to add a new set of the above controls for adding another rule.

  • Condition: Specify the expression for the condition in this text area.

  • Condition icon : Click the condition icon to open the Condition window to build the condition expression.

  • Output: Specify the output for the rule in this text box.

  • Stop Processing: Select this check-box to enable the process to be stopped when this rule is "true".

The window also has the Output text box to specify the output for the exception, that is when none of the rule conditions are true, in the [Else] (If none of the above conditions true) field.

Condition window

You can build expressions for the rule condition in this window, which is opened when you click the Condition icon in the Decisions property window. This window has the Select link, which you can use to specify the left hand side of the expression. On mouse-over this link opens a combo, with a collection of objects that you can specify for the left hand side of the expression. The window has the OK button at the bottom to save the new expression. The Cancel option allows you to cancel the expression and return to the property window.

Building an Expression for the Decision Condition

To illustrate the process of selecting an object for the right hand side of the expression, let us consider an XML Variable with "Employee" as a node and "FirstName" as an element under it. Specify this as the object for the left hand side of the expression. From the mouse over drop down, scroll down till you see the XML Variables node. Expand this node and the "Employee" node under it. Select the "FirstName" option.

Note: The C# code is not directly supported in the Expression editor for the Decision activity. If you want to return any value from the C# code, refer to the Returning Value from the C# Code topic.

The following window shows how to set an object for the left hand side of the expression:

This will display the operator combo with operators corresponding to the data type of the selected object. In this case, the data type being string, the operators are string operators, shown in the image below. Select "Equals" as the operator.

Operators combo with string operators

The default control to specify the object for the right hand side of the expression, which is a text box, is displayed at the right hand side of the row, as shown in the image below. You can specify a matching value in this text box. As the object selected is First Name, specify "John" here.

Default control for specifying the right hand side of the expression

This will complete the first expression and the settings will be displayed as shown below. You can mouse over any link to edit the value.

Using the Expression mode icon

Click the Expression mode icon, , to change the default text box to the Expression mode. In the Expression mode, you can select an object from the combo for the right hand side of the expression.

Consider that the left hand side of the expression is VirtualUserID. You can assign the Variables.SubmittedBy.UserId as the value for the right hand side.

You can select "Build Expression" in the Expression mode combo to open the Expression Editor and build an expression instead of specifying an object on either side of the expression. You can select "Enter a value" in the right hand side combo to return to the default mode, that is, the text box.

Click OK to save the expression and return to the Decision property window. The following image shows the window with Decision conditions added:

The Decision activity would be typically used in a workflow as shown below, with each decision output determining a different path for workflow execution.

Decision activity in a typical workflow

Returning Value from the C# Code

You must follow the following steps to return any value from the C# code:

  1. Declare a variable in the start activity.

  2. Initialize the variable in Start activity or using update variable using the C# code.

  3. This variable can be used in the Decision activity.

    Note: In Decision Activity, when you specify a value for comparing numeric, date, time, or date, time type of variables, you must specify the value in Invariant format.

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