Lab 07 - Create Guided Decision Table

Lab Goal

To create a guided decision table for shipping pricing for Cool Store

Creating Decision Table

  • We will create a guided decision table
    • AUTHORING -> PROJECT AUTHORING -> NEW ITEM -> GUIDED DECISION TABLE
    • GUIDED DECISION TABLE: Shipping Rules
    • PACKAGE: DEFAULT
    • (check box to use wizard...)

Creating Decision Table

  • Presented with wizard to setup your decision table
  • This is the Summary view
    • Name
    • Path
    • Table Format

Creating Decision Table

  • Imports - used to add your model types
    • click NEXT to go toImports
    • we need to add ShoppingCart by moving to right

Creating Decision Table

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

Creating Decision Table

  • Click NEXT, we add constraints on our shopping cart facts:
    • need to define what first two columns will be applied to
    • 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...

Creating Decision Table

  • 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'

Creating Decision Table

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

Creating Decision Table

  • Next adding an action to update facts
  • We will be updating the ShoppingCart shippingTotal in the last column of the 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...

Creating Decision Table

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

Creating Decision Table

  • Leave 'Add Actions to insert Facts' alone, not needed

Creating Decision Table

  • View 'Columns to expand' to ensure box checked
  • click 'Finish' button to display empty decision table

Creating Decision Table

  • Expand the '+ Decision table' along with exposed columns
  • We want to set a few options
    • click '+ New column'
    • select 'Add a new Metadata \ Attribute column' from pop-up
    • click 'OK'

Creating Decision Table

  • select from 'Attribute' drop down menu:
    • 'no-loop'
  • Repeat 'Add new Metadata \ Attribute column'
    • select from 'Attribute' drop down menu
    • 'ruleflow-group'
  • two options are available and two columns added

Creating Decision Table

  • finalize the options
    • no-loop: check box and check hide column
    • ruleflow-group: 'shipping-rules'

Creating Decision Table

  • Expand the '+ Decision table' along with exposed columns
    • use 'Add row...' button to add 5 empty rows to table
    • double click cells to add values as shown below

Creating Decision Table

  • Save the rule and ensure your package builds:
    • OPEN PROJECT EDITOR -> BUILD & DEPLOY
    • (should see green pop-up 'Build Successful')

Lab results...

Eric D. Schabell
JBoss Technology Evangelist
@ericschabell
http://schabell.org

JBoss BPM Suite Workshop

Lab 08 - Create Rule Flow