Using If Activity
If and If-Else activities can be used to execute a set of activities based on the condition specified.
In the case of If, a set of activities will execute when the specified condition evaluates to true.
In the case of If-Else, there are two sets of activities. One set will execute when the specified condition evaluates to true, and the other set will execute when the condition evaluates to false.
Let us understand both patterns of If and If-Else activities with an example process. Here is an example that takes two numbers as input and checks whether the numbers are sequential(ex: 1,2 or 8,9 or 10,11 etc).
Come, let's create this process in Process Designer:
Step#1
Launch and create a new process in Process Designer
- Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise
Step#2
Create New Process
- Click on New Process and fill in the new process details
Step#3
- Add a variable to hold numbers.
- Add one Boolean variable.
Step#4
In Activity panel search for Input Dialog
- Drag and drop Input Dialog
- Add two Input Dialog activities.
- Input Dialog will store the first and second numbers in appropriate variables.
Step#5
- Add If by setting the condition to check whether input numbers are sequential.
- Set the isComposite boolean variable to true
Step#6
- Add If-Else to check the isComposite flag.
- Display the output based on isComposite true or false
Step#7
Save the process
- From the Design tab ribbon, click on Save
Step#8
Run the process
- From the Design tab ribbon, click on Run
Step#9
Ensure the process executes and displays whether the numbers are composite.
Download Example (C#)