Hi!
I'm building some DMN rules that include a decision table with a hit policy of "Collect." I expect the output from the table to be a list of all decisions corresponding to matching rows in the table. I've attached a simple example DMN that I created on Drools Workbench, and a unit test file to go with it.
The rules simply identify a number as "Small" if it's less than 10, "Positive" if it's greater than 0, "Even" if it's both even and less than 11, and "Odd" if it's odd and less than 10. So for example I expect the output for the number 8 to be: ["Small", "Positive", "Even"].
It's quite possible I'm setting up the table wrong, and it's also possible that my notation in the unit tests is wrong, but the documentation has me going in circles. For example, the docs explicitly state that Drools implements an enhancement over DMN by allowing explicit declaration of lists, but it doesn't actually specify how (perhaps using the "list" function?), and nowhere does it illustrate specifying that a decision table can return a list.
When I set the return type to "string," as in the attached example, but put "null" (without quotes) in the decision field, I got an error message that "[]" was not of type string, which I found encouraging, because an empty list is exactly what I was hoping to get back, but I couldn't find a way to set a list type.
One thing I tried was defining a type as an alias for string, but enabling the "is collection" attribute, and Drools did indeed allow me to select that type for the output of the table -- but when running the rule, I got an "unrecognized data type" error. The DMN file did contain the ItemDefinition elements, so I don't know why that would be.
Another thing I noticed was that, when just one rule matched, a string was returned rather than a one-element list. This was with the type set to "string" and the hit policy set to "Collect," though.
Can anyone point me to the right bit of documentation and/or tell me how to use a "Collect" hit policy to get a list of decisions corresponding to all matching rules?
Thanks!
Len.