This section from an Excel table isn't written according to the rules for Drools decision tables. I'm merely pointing out all the deviations - please read the documentation to learn how to write decision tables. (Cells are numbered according to the posted PNG from A1 to H9. Also, please note that for simplicity's sake I'm using value, value1 and value2 rather than the original access code to fact values.)
- Cell H3 contains
tm
, which produces invalid RHS code (tm.System.out.println(...)
).
- Due to the omitted comment line in the rule table header (it should be in row 5) only rows 6, 7, 8 and 9 produce rules.
- After inserting row #5, five rules are generated due to rows 6 to 10 (originally 5 to 9), but all constraints are derived from the cell in row 4.
- Column B produces a pattern from the entries in rows 4 and 6 (originally 5) resulting in the text
Age < 2
which is not a valid pattern. This is due to B3 being empty.
- Column A, cells A6 through A10 (originally A5 through A9) results in rules where the pattern is alternatively
Claim(value == 10 == "true")
and Claim(value == 10 == "value == 11")
or similar. This compiles, but is hardly what you need to test the value in the Claim fact.
- Similarly, the RHS code resulting from the action column (column E) is alternatively
System.out.println("Done-1");
(or similar) and System.out.println("System.out.println(\"$param\");");
There isn't much point in trying to guess why you don't get the expected output. You have columns defining rule attributes agenda-group and activation-group but you don't provide the code setting and switching the agenda-group. As far as can be seen from this Excel snippet, neither column makes much sense.
The documentation contains enough examples for valid decision tables, so I refrain from repeating easily available information.
Edit A CONDITION must be written as cells in four rows. (You are using only three.) Here is how to write a pair of constraints, for attributes of the same class. Note that the 2nd and 3rd rule don't have a constraint based on age.
CONDITION CONDITION
-------------- Claim -------------
value == age <
Value must match Age must be less
10 2
11
12
The above shows 7 rows, 2 columns.
ACTION
System.out.println( "$param" )
Print something...
Done-1
Done-2
Done-3
Again 7 rows, 1 column.
There are almost identical examples for both in the documentation.