Hi Martin,

The decision tables on trunk do what you want and should be available in the 3.1 release (I think). The new code separates the rule template from the data and is more flexible than the current version. There are some integration tests that demonstrate how to use it (have a look at ExternalSpreadsheetCompilerIntegrationTest).

For your example you would use the following template:

template header
cheese
smell

package "com.cheese";

template "calculateSmell"
smell
rule "calculateSmell $row.rowNumber$"
  when
    cheese:Cheese()
  then
    cheese.setSmell("$smell$");
end
end template

I will put up some further doco on the wiki tonight.

cheers
Steve


On 2/15/07, Martin Weidner <martinweidner@icts-idc.nl> wrote:
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@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@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference