Using If Activity
If and If-Else activities can be used to execute a set of activities based on the condition specified.
In case of If, a set of activities will execute when the specified condition evaluates to true.
In case of If-Else, there are two sets of activities, one set of activities will execute when the specified condition evaluates to true and the other set of activities will execute when the condition evaluates to false.
Note: Flow decision activity is similar to If-Else. However Flow decision cannot be used ouside Flowchart
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 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 take first and second number and store in appropriate variables.
Step#5
- Add If by setting the condition to check whether input numbers are sequential or not.
- 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
Make sure the process executes and displays the numbers are composite or not.