◷ Reading Time: 2 minutes
You can create decision tables to build the expressions as rows.
For example, if you have a long list of fields in a form that you want to run a set of rules on, this pattern can be used.
Based on the data we provide in the decision table, expressions of the business rules will be built using the expression:
$cell(Field) $cell(Operation) $value
- Field: The variable parameter
- Operation: The operation of the expression
- Value: The value of the expression
All the variable parameters used in Field are defined as variable parameters.
In the decision table, this is how the expressions are created during the execution.
- IF Highest Education Level is “Advanced Diploma” THEN Score +=10
- IF Age >= 25 THEN Score +=5
<Logic name="table0row1"> <And> <Check value="true" /> <Check value="true" /> <Check value="Highest Education Level is "Advanced Diploma"" /> </And> <Then> <Var value="Score +=10" /> </Then> </Logic> <Logic name="table0row2"> <And> <Check value="true" /> <Check value="true" /> <Check value="Age >= 25" /> </And> <Then> <Var value="Score +=5" /> </Then>
If you click on Compile to Execution Plan, you can see these built expressions.
Download the sample project from the attachment at the end of the page.