skip to main content
Corticon Studio: Rule Modeling Guide : Advanced Ruleflow techniques and tools : Conditional Branching in Ruleflows : Example of Branching based on an Enumeration

Try Corticon Now
Example of Branching based on an Enumeration
In the example, four US states each have specific rules defined. Processing policy might require graceful rejection of requests that do not specify one of these four states. And,over time, the included states might expand or contract. This branch for State Specific Rules will be created as a separate Ruleflow, State Rules, so that it can be reused in other Ruleflows.
To create a Branch on a Ruleflow canvas for an attribute that is an enumerated list:
1. On the Ruleflow canvas, click Branch on the Palette, and then click on the canvas where you want to place the branch. A Branch compartment is created with your cursor in the name label area.
2. Enter a name such as State Specific Rules, and press Enter.
3. On the Branch's Properties tab for Branch Activity, click . The Select Branch Attributes for the Ruleflow's Vocabulary identifies three attributes that are candidates for branching (state, agency, and approved), and the associations that apply to these attributes.
4. Choose Applicant.state. The list of all US state abbreviations that is used by this attribute defines the enumeration in the Vocabulary, as shown:
Note: See Enumerations for information on entering or pasting enumeration labels and values as well importing them from a connected database.
5. Drag the Rulesheets California.ers, Idaho.ers, Texas.ers, Vermont.ers, and Other States.ers into the branch compartment on the canvas. You can use Ctrl+Click to select multiples and then drag them as a group. Each Rulesheet is marked with a error flag at this point, as shown:
6. On the canvas, click on the branch to open its Properties tab. You can define the enumeration branches in a few ways:
*Click on the Value pulldown. On separate value lines, choose each of the defined states and then other.
*Click Check for completeness, as shown, to populate the Value list from the attribute:
Notice that it does not add other to the list. If you set true and other as shown above, clicking Check for completeness would have nothing to add because other implies completeness. You can clear green highlights by clicking the Clear analysis results button.
The values listed are in red until we bind each one to a node.
7. Click on state value, then use the pulldown to select the appropriate node. In the following image, notice that the California node was assigned to the CA value, so that value turned black, the node on the canvas cleared the error, and the branching value is indicated in parentheses.
Note: An additional node was added to the canvas but because it is connected to a node, it is not offered in the pulldown list as a branch.
8. After matching the states with appropriate nodes, the Other States Rulesheet is unassigned. To handle this, a special purpose value is added. At the bottom of the value list, click on the down arrow and choose other.
Assign the Other States Rulesheet to that value.
9. Once all the nodes have been assigned to values, click Cleanup to clear all the unassigned values, as shown:
The unassigned values that were removed will all be handled by the other value's node. If you click Check for Completeness now, you will get the branch is complete.
That completes the creation of this enumeration-based branch.
Note: Other features of the user interface for defining Branch Activity are:
*Clicking a trashcan button on the right side of a branch line, deletes that line.
*Clicking the Clear button removes all lines (the branch and components on the canvas are not removed).
*The Extend to Database option is offered when the branching attribute is defined to connect to a database table and columns. The option is enabled in the Vocabulary editor by setting the attribute's Entity property Datastore Persistent to Yes. Choosing the option when it is available pulls the entities out of the defined and connected database and then processes the branch; when cleared, it tests against only the payload.