Details
-
Enhancement
-
Resolution: Done
-
Critical
-
6.2.0
-
None
Description
Description of problem:
As we can see in "6.5.3. How Decision Tables Work" [1], in a XLS Decision Table (DT) each row is a rule, and each column in that row is either a condition or action for that rule. The row with the keywords CONDITION and ACTION indicate that the data in the columns below are for either the LHS or the RHS parts of a rule. The next row in the file can contain declarations of ObjecTypes. The content in this row is optional, but if this option is not in use, the row must be left blank. When using this row, the values in the cells below become constraints on that object type. For example:
RuleTable NameRule | -> Rule name | ||
CONDITION | CONDITION | ACTION | -> LHS and RHS parts |
Person | Cheese | list | -> ObjectTypes |
age | type | add("$param") | -> parameters |
Person age | Cheese type | Log | -> COLUMN HEADER |
42 | stilton | Old man stilton | -> values for generating the rule |
In the above case, it generates Person(age=="42") and Cheese(type=="stilton").
When you convert this DT to a Guided Decision Table (GDT), it generates the GDT with a header for each condition. For the above example:
Person age | Cheese type | Log |
42 | stilton | Old man stilton |
Our problem is when an ObjectType declaration spans columns (via merged cells), meaning that all columns below the merged range are to be combined into one set of constraints within a single pattern matching a single fact at a time, as opposed to non-merged cells containing the same ObjectType, but resulting in different patterns, potentially matching different or identical facts. For example:
RuleTable NameRule | -> Rule name | ||
CONDITION | CONDITION | ACTION | -> LHS and RHS parts |
p:Person | -> 2 first columns are 1 | ||
age | type | p.setYear($param) | -> parameters |
Person age | Cheese type | Birth Year | -> COLUMN HEADER |
42 | stilton | 1973 |
When the above example is converted to a GDT, we obtain the following result:
Converted from C8 | Birth Year | |
42 | stilton | 1973 |
How do the header column "Converted from C8" is the header values "Person age" and "Cheese type"?
[1] http://docs.jboss.org/drools/release/latest/drools-docs/html_single/
Version-Release number of selected component (if applicable):
How reproducible:
Please use the attached XLS Decision Table file for reproducing the problem. Create a new Decision Table (Spreadsheet) with that file and "Convert to Guided Decision Table".
Steps to Reproduce:
1. Download the attached XLS Decision Table file (test3.xls)
2. Create a new Decision Table (Spreadsheet) with the above file.
3. Convert to Guided Decision Table.
Actual results:
Description | Converted from cell [C8] | Discount (%) | ||||||
1 | Created ... | ALL | XYZ | EL | HighEnd | 1 | 0 | 1.75 |
2 | Created ... | ALL | XYZ | EL | HighEnd | 5 | 1 | 2.0 |
Expected results:
Description | RTO | Manufacturer | Model | Segment | Age Min | Age Max | Discount (%) | |
1 | Created ... | ALL | XYZ | EL | HighEnd | 1 | 0 | 1.75 |
2 | Created ... | ALL | XYZ | EL | HighEnd | 5 | 1 | 2.0 |
Additional info: