cancel
Showing results for 
Search instead for 
Did you mean: 
SabrinaKniffin
Mission Specialist
Mission Specialist
  • 2,309 Views

Importing Business Rules Decision Tables

2 questions

1) When importing Business Rules Decision Tables, can you use something like this in a cell? >=2 && <= 60

or do you have to put it in this format 2<= age <= 60?

2) When importing Business Rules Decision Tables, if you want that particular rule to exclude a field, do you use a dash or just leave the field blank? 

Thanks!

Labels (1)
0 Kudos
2 Replies
oldbenko
Moderator
Moderator
  • 2,273 Views

Hey, @SabrinaKniffin,

Firstly - I took the liberty of moving your post to the "Developer & Middleware" section where it makes more sense.

Secondly, about the decision tables - there are three rules of thumb for decision tables that will help you keep them as simple and effective as possible:

  • if there is an && (logical and) condition, add a new column,
  • if there is an || (logical or) condition, create another rule (i.e., add another row),
  • if a condition does not apply, just leave the cell empty

The first two rules actually describe how the engine parses and processes rules with complex conditions anyway.

To answer your first question more specifically, let's say you are dealing with ages, so you want to generate rules that will fire or not, depending on the person's age (which is available as the age attribute of any Person object in working memory, supplied by the application invoking the rules).

What you want is perhaps something like this:

rule "one"
when Person(age < 18) then // require adult supervision end
rule "two" when Person(age > 65) then // require additional insurance end
rule "three" when Person(age >= 18 && age <= 65) then // provide service to the person end

Rules one and two are not difficult to implement in a decision table: two separate columns with "CONDITION" label in the first row, "Person" object in the second row, and in the third row:

  • age < $1 (for the column defining rule "one" condition)
  • age > $1 (for the column defining rule "two" condition)

Your data would then be:

  • data row 1: "18" in the first column,
  • data row 2: "65" in the second column.

For rule "three", however, you have two choices.

Either use a multi-value condition where you add another column, same data in the first two rows, but in the third row:

  • $1 >= age >= $2

Your data cell would then say "18, 65". This is irky and can easily be broken by users not knowing they need to enter two values, so a better approach is to add two additional columns:

  • age >= $1 (say, column three)
  • age <= $1 (say, column four)

Your data row 3 would then be "18" in column three and "65" in column four.

For more information, have a look at chapter 5 of the Decision Table Authoring Guide, more specifically:

  • there is a section called "Procedure" - step 6 explains how the engine handles empty cells;
  • another section is called "Conditions" - it explains how you can refer to the value of the current cell in the condition definition (even multiple values);

I hope this helps.

Cheers,
Grega

A black cat crossing the street signifies that the animal is going somewhere.
[don't forget to kudo a helpful post or mark it as a solution!]
SabrinaKniffin
Mission Specialist
Mission Specialist
  • 2,269 Views

Thank you!

0 Kudos
Join the discussion
You must log in to join this conversation.