Builder Pattern in Decision Tables

◷ 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

In this example, we use Field, Operation and Value. But you can provide any name for the columns.

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">
      <Check value="true" />
      <Check value="true" />
      <Check value="Highest Education Level is "Advanced Diploma"" />
      <Var value="Score +=10" />
  <Logic name="table0row2">
      <Check value="true" />
      <Check value="true" />
      <Check value="Age >= 25" />
      <Var value="Score +=5" />

If you click on Compile to Execution Plan, you can see these built expressions.

Download Project

Download the sample project from the attachment at the end of the page.

Updated on July 27, 2021

Article Attachments

Was this article helpful?

Related Articles