Comment on page
The EvaluateDecisionTable activity is used for defining, validating and executing decision tables.
To configure the EvaluateDecisionTable activity, drag the EvaluateDecisionTable workflow activity from the "Business Rules" module of the toolbox on to the designer.
Instead of going into a detailed discussion of the history of decision tables and the benefits, we will use the “Decision Table - Customer Discount” project in the Samples database to help you get started with decision tables in appRules.
In this example, there are four Conditions (the rule), to be used for deciding the discount to be applied to a customer order:
1. New Customer: Whether the customer is a new customer
2. Product Category: The category of the product being ordered
3. Sale Amount: The amount of the order
4. Number Of Prior Orders: The number of prior orders received from the customer
If the result of executing every condition on the row is “True”, then the following Actions will be performed:
1. Discount Percent: The discount percent to be applied to the order
2. Free Shipping: Whether to offer free shipping to the customer
To access the context menu for the decision table, right-click on the table. The menu items displayed will depend on the state of the table.
The context menu below is displayed when Conditions and Actions have not been defined:
The context menu below is displayed when Conditions and Actions have been defined:
To create a new Decision Table, drag the EvaluateDecisionTable activity from the "Business Rules" module of the toolbox on to the designer. The Decision Table Editor dialog will be displayed:
Right-click on the table to define the Conditions and Actions. Right-click displays a context menu of the available options for the row, column, or the decision table in general.
To add a new condition to the decision table, select “Add New Condition” from the context menu. The Add Condition Items Settings window will be displayed.
Enter a name for the Condition in the ConditionItemsName property. You can define each condition entry individually by clicking on the ConditionItems property, or you can click on the ConditionSettings property to create the entries as a group.
To add a new Action to the decision table, select “Add New Action” from the context menu. The Add Action Items Settings window will be displayed.
Enter a name for the Action in the ActionItemsName property. You can define each action entry individually by clicking on the ActionItems property, or you can click on the ActionSettings property to create the entries as a group.
To add new decision rows to the decision table, select “Add New Rows” from the decision table context menu. The following window will be displayed:
Enter the number of rows to add and select the default row values.
To test your decision table:
- 1.Check the ViewExecutionResults box in the "Edit Activity" modal:
- 2.Run the project by clicking the Run toolbar button on the home page. Enter the arguments to be used for running the job:
- 3.Click the Run button and the decision table results will be displayed as shown below: