I have a need to evaluate the values selected in a decision table at runtime. Specifically, in the decision table one option available to choose is the N/A. If there are 5 conditions available, and in one row the chosen values are X,Y, N/A, N/A, N/A and the next row is X, Y, 1, N/A, N/A and the input values (that matter are) X, Y, 1, then both rows would fire as true. However; the desire is to have the more specific row be the result (X, Y, 1). If the rows are in the "right" order then the correct row is selected, but we need the answer to be independent of the order of the rows. My thought is to provide some logic at runtime that would "count" the number of N/A choices and select the answer with the least number of N/A's. However; the values chosen from the table are not available in the template for the result template. Is there a way to make the value chosen in the table available to the result template so that I can count the number of conditions that were set to N/A?

Tom

Hi,

The result template is probably the wrong place for this kind of logic whichever way you choose to solve this. When the result is evaluated, the rule has already been fired, which means that the "wrong" rule has been selected.

Also note that unless you are using sequential mode for your ruleset, depending on the order of the rules breaks with the basic idea of declarative programming.

Is it possible to change the SRL content of the N/A code templates so that they to not say "true", but rather "<> (option1 or option2 or ...) " ? Note that in such a solution, you would have to generate rows for all the combinations of conditions you would like to have rules trigger for, as there will be no wildcard rows.

Another possible solution could be to add "additional" (hard coded) rules to the top of your ruleset, that set the value of some ruleset variables. These ruleset variables could then be used as the condition for the N/A-columns (one variable per column, probably). You could then set these variables to false, for example, if another, more specific value was present.

I don't know if these suggestions are helpful, but either way you should try to handle this in the left hand side/condition part of your rules.

Regards,

Jostein