[rules-users] How to generate rules from decision tables whereLHS has no field constraints
Martin Weidner
martinweidner at icts-idc.nl
Thu Feb 15 04:26:32 EST 2007
Hi Michael,
Thanks for your reply.
Leaving a cell empty results in the condition not being added to the rule at all. Which is fine, cause then you're more flexible in grouping rules with different conditions together in one decision table
I actually found a way yesterday, which seems to me more like a workaround. But it works:
| 1 | RuleTable calculateSmell |
| 2 | CONDITION | ACTION |
| 3 | | cheese |
| 4 | cheese:Cheese() | setSmell("$param"); |
| 5 | for every cheese| set smell to stinky |
| 6 | somevalue | stinky |
By declaring the variable not in the row right underneath below the CONDITION cell, but in the row where you normally declare the conditions (i.e. second row underneath the condition row
AND putting in some random value in the cell, that holds the parameter value, you can generate the desired rule:
#From row number: 6
rule "calculateSmell_6"
when
cheese:Cheese()
then
cheese.setSmell("stinky");;
end
Leaving out the parameter value results in the when line being blank, so you gotta fill in something.
I can live with that, but it seems to me more like a workaround, so I would be kinda curious whether there is (or will be) an "official" way of achieving this
Best regards,
Martin
________________________________________
Van: Michael Neale [mailto:michael.neale at gmail.com]
Verzonden: donderdag 15 februari 2007 01:05
Aan: Rules Users List
Onderwerp: Re: [rules-users] How to generate rules from decision tables whereLHS has no field constraints
you should be able to do that - just leave the constraint cells empty, or put some comment in them.
On 2/14/07, Martin Weidner < martinweidner at icts-idc.nl> wrote:
Hello,
Maybe I have overlooked something, but I couldn't find a way to generate a simple rule from an excel decision table, where the left hand side contains no field constraints?
i.e.
rule "do we have cheese"
WHEN
cheese: Cheese()
THEN
RHS
End
Is there a way to achieve this?
Thanks in advance,
Martin
_____________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list