If Else Feature
Introduction
In the vDesigner module, when you implement a functionality, you can define the condition-based logic (if-else condition) in the following ways:
- By defining a business rule
- By creating a sequential or conditional task group
Both ways help you implement the required functionality. You can use the business rule to implement smaller and linear application workflow.
For instance:- Assume you want to define the application’s behavior when a user clicks a button. To implement this functionality, you create a business rule and then define a condition in it. After you create the business rule, you map it to a task in the task group. Thus, you map the task group to the onClick event of the button.
If you observe the above example, you can find that using the business rule to implement a logic gives you the UI (user interface)-level scope (for example, defining the application behavior on the onClick event of a button or when a user selects a radio button).
On the other hand, in the task group, the If-Else feature gives a broader scope to implement the complex logic. In the If-Else block, you can define a condition that executes a group of tasks.
In the task group, you can also insert multiple Else-If blocks under a IF-Else block. When you use multiple Else_IF blocks, it allows you to implement mutually exclusive conditions. When a logic contains mutually exclusive conditions, the program controller stops and then creates output after a condition is satisfied.
The benefit of this approach is that the program controller does not check subsequent conditions unnecessarily. It makes the application lightweight and improves its latency.
Benefits of Task Group Incorporated If-Else Feature
The task group incorporated If-Else faeture provides following benefits:
- Lets you drag the task inside the If_Else block.
- Prevents unnenssary checks of all conditions after a condition is satisfied
- Provides logical clarity
- Prevents conflicting logic (separate “IF” blocks can accidently execute multiple blocks)
Use Cases
You can use the If-Else feature in the following use cases:
- In the educational and training module:- Define the path to next learning module based on the learner’s quiz score
- Displaying different messages to the user based on the user’s feedback in several applications
- Directing users to different pages based on their roles
- Categorization and classification data fed by user for subsequent follow up
Concept
In the task group, you can use the If-Else block in the following ways:
- By using the sequential task group
- By using the conditional task group
When you create a sequential task group, it does not provide a default If-Else block in the Execution panel. To use the If-Else block in the sequential task group, you need to drag the If-Else task from the Task panel to the Execution panel.

When you drag the If-Else task to the Execution panel, you can drag other tasks (for example, Navigation, Copy Data, and others) to the If-Else block to design the application behavior.
When you create the conditional task group, it displays the If-Else block in its empty state. After you access the dashboard of the conditional task group, the Execution panel automatically displays the If-Else block. In the dashboard, you do not need to drag the If-Else block from the Task panel.

Using If-Else Block
To use the If-Else block in a task group, you need to create a task group. You can desirably create a sequential task group or conditional task group. Both the task groups allow you to use the If-Else block.
To create a task group:
- On the Task Groups page, click Create Task Group to display the Create Task Group dialog box.
- On the Create Task Group dialog box, do the following:
- In the Name box, enter the name of the task group (for example, cond_tskgp1).
- Under Type, select one of the following:
- Sequential:- If you select this option, the task group by default does not display the If-Else block in the Execution panel. To use the If-Else block, you need to drag the If Else task from the Task panel.
- Conditional:- If you select this option, the task group displays the If-Else block in the Execution panel.
- In the Description box, enter a brief reason to create the task group.
- After you enter the details to create the task group, click Create to create a new task group.
After you create a sequential or conditional task group, you can use the If-Else block as follows:
Set Condition
This functionality allows you to define a condition in the If-Else block. The task group module provides the Set Condition functionality in two blocks: the If block and the Else If block. By using the Set Condition functionality, you can map a business rule to the current task group.
If you did not define the condition, create a new business rule, define a condition in it, and map the business rule to the task group by using the Set Condition function.
To set a condition:
- In the If or Else-If block, click Set Condition to display the Business Rules panel.
- In the Business Rules panel, select the business rule and then click Save to map the task group to the business rule.
Creating Else-If Branch
In the If-Else block, you can create one or more Else-If blocks. You can use the Else_If blocks when you want to define multiple mutually exclusive conditions. At runtime, the program controller checks these conditions. When a condition is satisfied, the program controller stops and then creates the output.
To define the condition in the Else-If block, click Set Condition and then select the business rule. To know more about the Set Condition function, click here.
Best Practices
While using the If-Else condition in the task group, you can use the following best practices:
- Before you create the task group, decide if you want to create a sequential task group or a conditional task group.
- In the task group, use the Else-If condition if you want to define multiple mutually exclusive conditions.
- Before you create a task group, it is recommended to define the condition that you want to use in the If-Else block.
- To design a clutter-free logic, define only one condition in a business rule. Do not define multiple conditions in a business rule.
- First define a condition in the If block.
Troubleshooting
If the application does not produce the expected output, check the following:
- Check if you defined correct conditions in the related blocks.
- Check the sequence of different conditions in the related blocks.
- Check if you defined the condition in the “If” block. If you do not define the condition in the “If” block, the Task Groups module will not let you configure the current task group.