Hello,<br>well, You are right, but what if I want to use object's method in ACTION section like this:<br><br><br><br><table style="border-collapse: collapse; width: 476pt;" border="0" cellpadding="0" cellspacing="0" width="634">
<tbody><tr style="min-height: 9pt;" height="12"><td style="min-height: 9pt; width: 125pt;" height="12" width="167"><br></td>
<td style="width: 79pt;" width="105">CONDITION</td>
<td style="width: 114pt;" width="152">ACTION</td>
<td style="width: 118pt;" width="157">ACTIVATION-GROUP</td>
<td style="width: 40pt;" width="53">PRIORITY</td>
</tr>
<tr style="min-height: 18.75pt;" height="25">
<td style="min-height: 18.75pt; border-top: medium none;" height="25"> </td>
<td style="border-top: medium none;">p:CProduct</td>
<td style="border-top: medium none;"> </td>
<td style="border-top: medium none;"> </td>
<td style="border-top: medium none;"> </td>
</tr>
<tr style="min-height: 29.25pt;" height="39">
<td style="min-height: 29.25pt; border-top: medium none; width: 125pt;" height="39" width="167"> </td>
<td style="border-top: medium none; border-left: medium none; width: 79pt;" width="105">name</td>
<td style="border-top: medium none; width: 114pt;" width="152">System.out.println(p.getName() + " " + "$param");</td>
<td style="border-top: medium none; border-left: medium none; width: 118pt;" width="157"> </td>
<td style="border-top: medium none; border-left: medium none; width: 40pt;" width="53"> </td>
</tr>
<tr style="min-height: 22.5pt;" height="30">
<td style="min-height: 22.5pt; width: 125pt;" height="30" width="167">Rules names<br></td>
<td style="border-top: medium none; border-left: medium none; width: 79pt;" width="105">Product name</td>
<td style="width: 114pt;" width="152">what to print<br></td>
<td style="border-left: medium none; width: 118pt;" width="157"> </td>
<td style="border-left: medium none; width: 40pt;" width="53"> </td>
</tr>
<tr style="min-height: 28.5pt;" height="38">
<td style="min-height: 28.5pt;" height="38">Case A<br></td>
<td style="border-top: medium none; border-left: medium none;">A <br></td>
<td>Special A<br></td>
<td style="border-left: medium none;">G1</td>
<td style="border-left: medium none;">1</td>
</tr>
<tr style="min-height: 21.75pt;" height="29">
<td style="min-height: 21.75pt;" height="29">Case B<br></td>
<td style="border-top: medium none; border-left: medium none;">B</td>
<td>Special B</td>
<td style="border-left: medium none;">G1</td>
<td style="border-left: medium none;">1</td>
</tr>
<tr style="min-height: 46.5pt;" height="62">
<td style="min-height: 46.5pt;" height="62">General case<br></td>
<td style="border-top: medium none; border-left: medium none;"><br></td>
<td>normal</td>
<td style="border-left: medium none;">G1</td>
<td style="border-left: medium none;">0</td></tr></tbody></table><br>In this case, I want for each CProduct fire it's method in ACTION column (like in rule "Case general" for DRL.<br>Thanks :)<br><br><br>
<br><div class="gmail_quote">2010/7/28 Mauricio Salatino <span dir="ltr"><<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
you can remove p, because in the spreadsheet you are not using it.. <br>in the rules you use p to print the type of the product but in the spreadsheet you are hardcoding the value in the "what to print" column<br>
<br><div class="gmail_quote">2010/7/27 tom ska <span dir="ltr"><<a href="mailto:tiberium.linux@gmail.com" target="_blank">tiberium.linux@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">
Hello,<br>I want to use StatelessSession with spreadsheet. I wrote few rules in DRL, but I cant do it in spreadsheet. First I want to present rules and class that is used by rules:<br><br>public class CProduct {<br><br> private String name;<br>
private int value;<br><br> public CProduct ()<br> {<br> name = "empty";<br> value = 0;<br> }<br> <br> public CProduct (String name, int value)<br> {<br> <a href="http://this.name" target="_blank">this.name</a> = name;<br>
this.value = value;<br> }<br> <br> public String getName() {<br> return name;<br> }<br> public void setName(String name) {<br> <a href="http://this.name" target="_blank">this.name</a> = name;<br>
}<br>
public int getValue() {<br> return value;<br> }<br> public void setValue(int value) {<br> this.value = value;<br> } <br>}<br><br>Rules:<br><br>rule "Case A"<br>salience 1<br>activation-group "g1"<br>
when<br> p : CProduct( name == "A" )<br> then<br> System.out.println("Special product: " + p.getName());<br>end<br><br>rule "Case B"<br>salience 1<br>activation-group "g1"<br>
when<br> p : CProduct( name == "B" )<br> then<br> System.out.println("Special product: " + p.getName());<br>end<br><br>rule "Case general"<br>salience 0<br>activation-group "g1"<br>
when<br> p : CProduct( )<br> then<br> System.out.println("Normal product: " + p.getName());<br>end<br><br>Using stateLessSession, salience, and activation-group I can determine, that only one rule is going to be fired for each CProduct. And with salience param, I can determine priority (it is important to get special products first).<br>
Now I am going to write those rules in spreadsheet. But I can't define rule "Case general".<br><br><br>
<table style="border-collapse: collapse; width: 476pt;" border="0" cellpadding="0" cellspacing="0" width="634"><col style="width: 125pt;" width="167">
<col style="width: 79pt;" width="105">
<col style="width: 114pt;" width="152">
<col style="width: 118pt;" width="157">
<col style="width: 40pt;" width="53">
<tbody><tr style="min-height: 9pt;" height="12">
<td style="min-height: 9pt; width: 125pt;" height="12" width="167"> </td>
<td style="width: 79pt;" width="105">CONDITION</td>
<td style="width: 114pt;" width="152">ACTION</td>
<td style="width: 118pt;" width="157">ACTIVATION-GROUP</td>
<td style="width: 40pt;" width="53">PRIORITY</td>
</tr>
<tr style="min-height: 18.75pt;" height="25">
<td style="min-height: 18.75pt; border-top: medium none;" height="25"> </td>
<td style="border-top: medium none;">p:CProduct</td>
<td style="border-top: medium none;"> </td>
<td style="border-top: medium none;"> </td>
<td style="border-top: medium none;"> </td>
</tr>
<tr style="min-height: 29.25pt;" height="39">
<td style="min-height: 29.25pt; border-top: medium none; width: 125pt;" height="39" width="167"> </td>
<td style="border-top: medium none; border-left: medium none; width: 79pt;" width="105">name</td>
<td style="border-top: medium none; width: 114pt;" width="152">System.out.println("$param");</td>
<td style="border-top: medium none; border-left: medium none; width: 118pt;" width="157"> </td>
<td style="border-top: medium none; border-left: medium none; width: 40pt;" width="53"> </td>
</tr>
<tr style="min-height: 22.5pt;" height="30">
<td style="min-height: 22.5pt; width: 125pt;" height="30" width="167">Rules names<br></td>
<td style="border-top: medium none; border-left: medium none; width: 79pt;" width="105">Product name</td>
<td style="width: 114pt;" width="152">what to print<br></td>
<td style="border-left: medium none; width: 118pt;" width="157"> </td>
<td style="border-left: medium none; width: 40pt;" width="53"> </td>
</tr>
<tr style="min-height: 28.5pt;" height="38">
<td style="min-height: 28.5pt;" height="38">Case A<br></td>
<td style="border-top: medium none; border-left: medium none;">A <br></td>
<td>Special A<br></td>
<td style="border-left: medium none;">G1</td>
<td style="border-left: medium none;">1</td>
</tr>
<tr style="min-height: 21.75pt;" height="29">
<td style="min-height: 21.75pt;" height="29">Case B<br></td>
<td style="border-top: medium none; border-left: medium none;">B</td>
<td>Special B</td>
<td style="border-left: medium none;">G1</td>
<td style="border-left: medium none;">1</td>
</tr>
<tr style="min-height: 46.5pt;" height="62">
<td style="min-height: 46.5pt;" height="62">General case<br></td>
<td style="border-top: medium none; border-left: medium none;"><br></td>
<td>normal</td>
<td style="border-left: medium none;">G1</td>
<td style="border-left: medium none;">0</td>
</tr>
</tbody></table><br>But when I am going to use the spreadsheet, I get this error:<br><br>"p cannot be resolved"<br><br>Problem disappears, when I fill "Product name" in "General case".<br><br>
But I want it to be empty, because I want to fire rule "General case" when rules "Case A" & "Case B" won't fire for any object's name.<br><br>Thanks, Tom.<br><br><br>
<br></div></div><div class="im">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></div></blockquote></div><div><div></div><div class="h5"><br><br clear="all"><br>-- <br> - CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a> <br> - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>
- Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br> <br> - Salatino "Salaboy" Mauricio -<br>
</div></div><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>