System.Activities.Statements.FlowDecision
- FlowDecision activity is used to execute one of two branches, depending on whether a specified condition is met.
- The branches are entitled True and False by default, but the names can be changed in the Properties panel.
- FlowDecision can only be used in a Flowchart and equivalent to the If
Properties
Misc
- Condition (Activity<Boolean>) – Define a condition/an expression which returns boolean result.
- DisplayName (String) – To set a meaningful name according to the user.
- FalseLabel (String) – False is the default name but it can changed by the user.
- TrueLabel (String) – True is the default name but it can changed by the user.
Example
To use FlowDecision activity, create an automation that asks user for a number, checks if it is even or not, and depending on that, displays a different message in the Output panel.
- Create a flowchart.
- Create an integer variable, Number.
- Add an Input Dialog activity and connect it to the Start
- In the Properties panel, type label and title to prompt user for a number and, in the Result field, add the Number
- Add a FlowDecision activity connect it to the previously added Input Dialog.
- In the Condition field, type Number mod 2. This checks if the number is divisible by 2.
- In the TrueLabel side, add a MessageBox
- In the Text field, type ToString+ “ is an even number.“
- In the FalseLabel side, add a MessageBox
- In the Text activity, type ToString+ “ is an not an even number.”.
- Run the process and see the data correctly which displays in the screen while executing and in the Output panel after the execution