Hi Martin,<br><br>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).
<br><br>For your example you would use the following template:<br><br>template header<br>cheese<br>smell<br><br>package &quot;com.cheese&quot;;<br><br>template &quot;calculateSmell&quot;<br>smell<br>rule &quot;calculateSmell $row.rowNumber$&quot;
<br>&nbsp; when<br>&nbsp;&nbsp;&nbsp; cheese:Cheese()<br>&nbsp; then<br>&nbsp;&nbsp;&nbsp; cheese.setSmell(&quot;$smell$&quot;);<br>end<br>end template<br><br>I will put up some further doco on the wiki tonight.<br><br>cheers<br>Steve<br><br><br><div><span class="gmail_quote">
On 2/15/07, <b class="gmail_sendername">Martin Weidner</b> &lt;<a href="mailto:martinweidner@icts-idc.nl">martinweidner@icts-idc.nl</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Michael,<br><br>Thanks for&nbsp;&nbsp;your reply.<br><br>Leaving a cell empty results in the condition not being added to the rule at all. Which is fine, cause then you&#39;re more flexible in grouping rules with different conditions together in one decision table
<br>I actually found a way yesterday, which seems to me more like a workaround. But it works:<br><br>| 1 | RuleTable calculateSmell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>| 2 |&nbsp;&nbsp;&nbsp;&nbsp;CONDITION&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp; ACTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>| 3 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | cheese&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|
<br>| 4 | cheese:Cheese() | setSmell(&quot;$param&quot;); |<br>| 5 | for every cheese| set smell to stinky |<br>| 6 | somevalue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | stinky&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br><br>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<br>AND putting in some random value in the cell, that holds the parameter value, you can generate the desired rule:<br><br>#From row number: 6<br>rule &quot;calculateSmell_6&quot;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cheese:Cheese()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cheese.setSmell(&quot;stinky&quot;);;<br>end<br><br>Leaving out the parameter value results in the when line being blank, so you gotta fill in something.
<br>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 &quot;official&quot; way of achieving this<br>Best regards,<br>Martin<br>________________________________________
<br>Van: Michael Neale [mailto:<a href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>]<br>Verzonden: donderdag 15 februari 2007 01:05<br>Aan: Rules Users List<br>Onderwerp: Re: [rules-users] How to generate rules from decision tables whereLHS has no field constraints
<br><br>you should be able to do that - just leave the constraint cells empty, or put some comment in them.<br>On 2/14/07, Martin Weidner &lt; <a href="mailto:martinweidner@icts-idc.nl">martinweidner@icts-idc.nl</a>&gt; wrote:
<br>Hello,<br>Maybe I have overlooked something, but I couldn&#39;t find a way to generate a simple rule from an excel decision table, where the left hand side contains no field constraints?<br>i.e.<br>rule &quot;do we have cheese&quot;
<br>WHEN<br> cheese: Cheese()<br>THEN<br> RHS<br>End<br>Is there a way to achieve this?<br>Thanks in advance,<br>Martin<br>_____________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br>_______________________________________________<br>rules-users mailing list
<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div>
<br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501<br><a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au
</a><br><a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au</a><br><br>consulting | development | training | support<br>our experience makes the difference