Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The WhileActivity activity iteratively executes its child activities as long as the result of evaluating its Condition property is true. A rule condition that is associated with the Condition property is evaluated before each iteration of the WhileActivity loop. If the condition evaluates to true, the child activities are executed. If the condition evaluates to false, the child activities is not executed, and the WhileActivity execution is terminated.
To configure a While activity, drag the While workflow activity from the "Control Flow" module of the toolbox on to the designer.
Conditions and Actions are used extensively in the appRules Integration & Automation Engine.
Before continuing with the other sections, please review Conditions and Actions in the documentation for the Platform Features.
Examples of usage of Conditions and Actions in workflow activities include:
EvaluateCondition - Evaluates a single condition and makes the result available for use in further evaluations of conditions or workflow activities.
EvaluateConditions - Evaluates a group of conditions and performs a set of actions based on the result.
PerformAction - Performs the selected action. A value is returned if the action type is Action Field.
PerformActions - Performs a list of actions. Conditions can also be entered to indicate the specific actions in the list to be executed.
Decision Tables - The decision rows of decision tables are made up of the conditions to evaluate and the actions to execute if the Conditions evaluate to True.
The appRules Integration & Automation Engine includes several conditions, actions and workflow activities for implementing process automation, business rules and decision support projects.
In this section, we will review the components that make up the process automation, business rules and decision support modules of the appRules Integration & Automation Engine.
The ExecuteRuleSet activity is used for defining, validating and executing Rule Sets in appRules. Rule Set in appRules is a set of rules and the Actions to be performed when each rule evaluates to true or false.
To create a Rule Set, drag an ExecuteRuleSet activity from the "Business Rules" module of the toolbox on to the designer. The following modal will be displayed:
Enter a Rule Name, then click on the button after the name to set the related condition.
For each rule, you can set action(s) if true or false.
To add new rules and actions, right click in the related area of the window to display the context menu:
To test your rule set, simply click the Run button from your IDE. If the ViewExecutionResults property is set to True (checked), the result of the run in debug mode will be displayed.
The following activities are used for performing actions:
PerformAction
PerformActions
The PerformAction activity is used for performing any Action available in appRules.
To configure a PerformAction activity, drag the PerformAction activity from the Base module of the toolbox on to the designer. Select the Action or configure a new one. Then save the workflow activity.
The PerformActions activity is used for performing a group of actions.
To configure the PerformActions activity, drag the PerformActions activity from the "Business Rules" module of the toolbox on to the designer. The following modal will be displayed:
To add Actions to the list of actions to be performed:
Enter the column values for each Action as follows:
Column | Description |
---|---|
Condition
Select optional condition for executing the action
Action Default/True
Select the action to be executed if the condition is not specified or is True. This field is required.
Action False
Select optional action to be executed if the condition is specified and evaluates to False
Description
Enter the unique name for the action item. This field is required.
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.
The “Decision Table - Customer Discount” decision table applies the appropriate discount to a customer order based on predefined conditions as shown in the table below:
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:
Check the ViewExecutionResults box in the "Edit Activity" modal:
Run the project by clicking the Run toolbar button on the home page. Enter the arguments to be used for running the job:
Click the Run button and the decision table results will be displayed as shown below:
The following activities are used for evaluating conditions:
EvaluateCondition
EvaluateConditions
The EvaluateCondition activity is used to evaluate a condition in appRules.
To configure a EvaluateCondition activity, drag the EvaluateCondition activity from the Base module of the toolbox on to the designer. Select the Condition or configure a new one. Then save the workflow activity.
The EvaluateConditions activity is used to evaluate a group of conditions.
To configure the EvaluateConditions activity, drag the EvaluateConditions activity from the "Business Rules" module of the toolbox on to the designer. The following modal will be displayed:
Configure the Conditions by entering a unique description for each Condition, and clicking the configuration button to select or configure the Condition. Note: Right-Mouse-Click on any row to view a menu of additional options.
Configure the optional THEN Actions by entering a unique description for each Action, and clicking the configuration button to select or configure the Action. These Actions will be performed only if the Conditions evaluate to True. Note: Right-Mouse-Click on any row to view a menu of additional options.
Configure the optional ELSE Actions by entering a unique description for each Action, and clicking the configuration button to select or configure the Action. These Actions will be performed only if the Conditions evaluate to False. Note: Right-Mouse-Click on any row to view a menu of additional options.
Click the "Evaluation Option" toolbar button to set the evaluation option for the Conditions to be included in the list.
Click the "Evaluation Option" toolbar button to set the execution option for the Actions to be performed if the Conditions evaluate to True - (Then Actions Option)
Click the "Evaluation Option" toolbar button to set the execution option for the Actions to be performed if the Conditions evaluate to False - (Else Actions Option)