Shipping Rules - Create decision table

Click on ADD ASSET -> GUIDED DECISION TABLE for pop-up:
  • GUIDED DECISION TABLE: Shipping Rules
  • PACKAGE: default
  • Fill as shown, click on +OK to create rule:

Shipping Rules - Meet the wizard

Use wizard to setup decision table, Summary field completion and then click NEXT button at bottom:
  • NAME: Shipping Rules

Shipping Rules - Imports

Here you can add data types to decision table:
  • add ShoppingCart data type by moving to right using arrows and click NEXT button

Shipping Rules - Add fact patterns

Now we add facts to help define our column constraints:
  • select ShoppingCart and add to 'Chosen Patterns'
  • select 'Chosen Patterns' to add Binding for this: '$sc' (ignore 'From Entry Point') and click NEXT button

Shipping Rules - Add a constraint

Click NEXT, we add constraints on our shopping cart facts:
  • need a column for total shipping bottom to top range
  • select $sc.ShoppingCart to see 'Available fields'
  • select 'cartItemTotal:Double', use arrow to add to 'Conditions'
  • note: condition is red, as needs to be defined yet...

Shipping Rules - Complete constraint

To finish, must define conditions:
  • select 'cartItemTotal' to bring up fields to edit at bottom
  • fill in 'Column header (description):' 'Total >='
  • select 'Operator:' 'greater than or equal to'

Shipping Rules - Add another constraint

Now complete the same again for the 'Total <' column:
  • add and select another 'cartItemTotal ' to bring up fields to edit at bottom
  • fill in 'Column header (description): ' 'Total <'
  • select 'Operator:' 'less than' and click NEXT button

Shipping Rules - Add action to update facts

Start by updating ShoppingCart shippingTotal in the last column of table:
  • select '$sc:ShoppingCart' to view 'Available fields'
  • select 'shippingTotal:Double' field
  • add to 'Chosen fields' with arrow button
  • note: red item shows definitions are not complete yet...

Shipping Rules - Complete action to update facts

Select 'shippingTotal' in 'Chosen fields to expose definitions:
  • add 'Column header (description):' 'Shipping Total'
  • the rest of the fields can be left empty and click on NEXT button

Shipping Rules - Add action to insert facts

Click on NEXT button to skip 'Add Actions to insert Facts', not needed:

Shipping Rules - Columns to expand

View 'Columns to expand' to ensure box checked and click 'Finish' button to generate your empty decision table:

Shipping Rules - Wizard generates decision tabel

The wizard setup has completed to start a decision table:

Shipping Rules - Add no-loop attribute

Click on top level menu button 'Insert' to drop down entry 'Add column':
  • click box 'Include avanced options'
  • select 'Add an Attribute column' from list
  • click on NEXT and select 'no-loop'
  • click 'FINISH'

Shipping Rules - Add ruleflow-group attribute

Repeat 'Add new Attribute column':
  • click box 'Include avanced options'
  • select 'Add an Attribute column' from list
  • click on NEXT and select 'ruleflow-group
  • click 'FINISH'

Shipping Rules - Verify attributes

Validate attribute additions:
  • click on 'Columns' tab at top of decision table
  • select 'Attribute columns' from list
  • note 'no-loop' and 'ruleflow-group entries waiting to be filled

Shipping Rules - Finalize attributes

Finalize attributes:
  • no-loop: check box and check hide column
  • ruleflow-group: 'shipping-rules'
  • click on 'Model' tab at top of decision table to finish

Shipping Rules - Add rows to table

Using 'Insert' drop down 'Append row' to add empty rows to table:
  • add 5 empty rows to table
  • the empty table should look like below

Shipping Rules - Add rules data to table

Update all rows by clicking on cells to add values as shown:

Shipping Rules - Verify rule

This completes the technical rule, it should look like this:

Saving your work

  • Be sure to SAVE your work by clicking button top right
  • Optionally add a comment and click SAVE WITH COMMENTS drop-down in menu
  • This completes the Total Shopping Cart Item technical rule

Shipping Rules - Validate that project builds

Return to Asset view by clicking on retail-webshop project in bread crumb menu at top:
  • click 'Build' button at top
  • note green validation of build

Lab completed - Results

Eric D. Schabell
Portfolio Architect Director
@ericschabell
http://schabell.org
More Red Hat Decision Manager Workshops:

Red Hat Decision Manager Articles:

Red Hat Decision Manager Demos:

Up next...

Lab 8 - Create rule flow