How can we implement nested if-else and if-elseif conditions in Business Rules (BR) using a Rule and Ruleset structure?

How can we implement nested if-else and if-else-if conditions in Business Rules (BR) using a Rule and Ruleset structure in VDesigner 2.0?

3 Likes

Hello @Ritik_Dixit, we can implement nested if-else and if-else-if conditions using a combination of Rule and Rule Set structures inside the Business Rule Manager.

  • A Rule allows us to group multiple conditions (When blocks) using AND or OR logical operators.
  • A Rule Set lets us combine multiple Rules, again with AND or OR operators, allowing us to build more complex, layered logic — similar to nested if-else or if-else-if conditions.

For Nested If-Else Logic:

  • We create a Rule with a specific condition in a When block.
  • Inside the same Rule Set, we can add another Rule that will be triggered if the first Rule fails or passes, mimicking a nested if-else structure.
  • Each Rule’s condition can branch differently depending on whether the previous one is true or false.

For If-Else-If Logic:

  • We define multiple Rules sequentially inside a single Rule Set.
  • Each Rule checks a different condition.
  • Based on which condition matches first, the application can decide the flow, very similar to traditional if-else-if ladders in programming.

Here is an example

7 Likes