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
    • RESOURCE NAME: Shipping Rules

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
    • we only need to add a ShoppingCart

Creating Decision Table

  • Now we need to add facts to help define our column constraints
    • select ShoppingCart and add to 'Chosen Patterns'
    • add Binding for this: '$sc'
    • ignore 'From Entry Point', not using event streams in table

Creating Decision Table

  • Next we define constraints on our shopping cart
    • need to define what the 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' and use arrow button to add to 'Conditions'
    • note: Error will show that conditions need 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' from list

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' from list

Creating Decision Table

  • Next adding an action to update facts
  • Update 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: Error will show that definitions are not complete

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
  • 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
    • use 'Add row...' button to add 5 empty rows to table
    • double click each field to add values as shown in image below

Creating Decision Table

  • Finally 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 adding new metadata \ attribute column as a new 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 'Default value:' box and hide column
    • ruleflow-group: add to field 'shipping-rules' hide column
  • final decision table show below

Creating Decision Table

  • Save the rule.
  • Ensure your package builds:
    • TOOLS -> PROJECT EDITOR -> BUILD & DEPLOY
    • (should see green pop-up 'Build Successful')
Eric D. Schabell
JBoss Technology Evangelist
@ericschabell
http://schabell.org

JBoss BPM Suite Workshop

Lab 08 - Create Rule Flow