Red Hat Training

A Red Hat training course is available for Red Hat Decision Manager

Chapter 3. Guided Rules

Guided Rules are business rules that you can create in a UI-based Guided Rules designer that leads you through the rule creation process. The rule designer provides fields and options for acceptable input based on the object model of the rule being edited. All data objects related to the rule must be in the same project package as the rule. Assets in the same package are imported by default. You can use the Data Objects tab of the rule designer to verify that all required data objects are listed or to import any other needed data objects.

Figure 3.1. The Guided Rule designer

The Guided Rule designer

3.1. Creating the Driver License Suspension rule

Create the Driver license suspension rule using the Guided Rule wizard.

Prerequisite

You have created both the Violation and Driver data objects.

Procedure

  1. Log in to Decision Central.
  2. Click MenuDesignProjects, then Driver_department_traffic_violations.
  3. Click Add AssetGuided Rule, then enter:

    • Guided Rule: DriverLicenseSuspensionRule
    • Package: com.myspace.driver_department_traffic_violations
  4. Click Ok to open the Guided Rule designer.

    Figure 3.2. Create new Guided Rule window

    guided rule

3.2. Setting the Suspension rule conditions

Set the Suspension rule conditions that are used to determine the driver’s violation.

Prerequisite

You have created the Driver License Suspension rule.

Procedure

  1. Click ( 6176 ) next to the WHEN label to open the Add a condition to the rule window.
  2. Select Driver and click Ok.

    Figure 3.3. Create new Guided Rule window

    add condition
  3. Click the There is a Driver label to open the Modify constraints for Driver window.
  4. Enter driver in the Variable name field and click Set.
  5. Click There is a Driver[driver] and click Expression editor.
  6. Click [not bound] to open the Expression editor.
  7. In the Bind the Expression to a new variable field, enter: previousPts and click Set.
  8. From the Choose menu, select totalPoints.
  9. Click ( 6176 ) next to line 1 (the previousPts label) to open the Add a condition to the rule window.
  10. Select From Accumulate and click Ok.
  11. Click click to add pattern above the From Accumulate label and select Number from the choose fact type menu.
  12. Click There is a number label to open the Modify contraints for Driver window.
  13. Click Expression editor and select intValue() from the [not bound]: Choose menu.
  14. Click [not bound] to open the Expression editor.
  15. In the Bind the Expression to a new variable field, enter: totalNewPoints and click Set.
  16. Click click to add pattern and select Violation from the choose fact type menu.
  17. Click All Violation with: to open the Modify contraints for Violation window and select points from the Add a restriction on a field menu.
  18. Click please choose next to the points label and select greater than.
  19. Click ( 6191 ), and then click Literal value.
  20. Click the points label to open the Add a field window.
  21. Enter vPoints and click Set.
  22. In the Function field, enter sum(vPoints).
  23. Select greater than or equal to from the totalNewPointsplease choose menu.
  24. Click ( 6191 ), click New formula, and enter 20-previousPts in the new field.
  25. Click Save, and then click Save to confirm your changes.

Figure 3.4. Suspension Rule conditions

rule conditions

3.3. Setting the Suspension rule actions

Set the Suspension rule actions that are used to determine a driver’s resulting penalties, including points and fine amounts, based on the Suspension rule conditions.

Prerequisite

You have set the Suspension rule conditions.

Procedure

  1. Click (show options…​).

    Figure 3.5. show options selection

    show options
  2. Click ( 6176 ) next to the THEN label and select Change field values of driver, and click Ok.
  3. Click the Set value of Driver [driver] field and select state from the Add field menu.
  4. Click ( 6191 ) next to state in the Set value of Driver [driver] section to open the Field value window.
  5. Click Literal value and enter suspend in the new field.

    Figure 3.6. New field

    suspend entry
  6. Click ( 6176 ) next to the (options) label below the Set value of Driver [driver] section.
  7. From the Add an option to the rule window, select the ruleflow-group option from the Attribute menu.
  8. Enter trafficViolation in to the ruleflow-group field.
  9. Click Save, and then click Save to confirm your changes.

    Figure 3.7. Suspension rule actions

    rulepanel