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">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">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="height: 9pt;" height="12">
<td class="xl65" style="height: 9pt; width: 125pt;" height="12" width="167"> </td>
<td class="xl66" style="width: 79pt;" width="105">CONDITION</td>
<td class="xl66" style="width: 114pt;" width="152">ACTION</td>
<td class="xl66" style="width: 118pt;" width="157">ACTIVATION-GROUP</td>
<td class="xl66" style="width: 40pt;" width="53">PRIORITY</td>
</tr>
<tr style="height: 18.75pt;" height="25">
<td class="xl65" style="height: 18.75pt; border-top: medium none;" height="25"> </td>
<td class="xl72" style="border-top: medium none;">p:CProduct</td>
<td class="xl72" style="border-top: medium none;"> </td>
<td class="xl72" style="border-top: medium none;"> </td>
<td class="xl72" style="border-top: medium none;"> </td>
</tr>
<tr style="height: 29.25pt;" height="39">
<td class="xl68" style="height: 29.25pt; border-top: medium none; width: 125pt;" height="39" width="167"> </td>
<td class="xl75" style="border-top: medium none; border-left: medium none; width: 79pt;" width="105">name</td>
<td class="xl69" style="border-top: medium none; width: 114pt;" width="152">System.out.println("$param");</td>
<td class="xl69" style="border-top: medium none; border-left: medium none; width: 118pt;" width="157"> </td>
<td class="xl69" style="border-top: medium none; border-left: medium none; width: 40pt;" width="53"> </td>
</tr>
<tr style="height: 22.5pt;" height="30">
<td class="xl68" style="height: 22.5pt; width: 125pt;" height="30" width="167">Rules names<br></td>
<td class="xl75" style="border-top: medium none; border-left: medium none; width: 79pt;" width="105">Product name</td>
<td class="xl69" style="width: 114pt;" width="152">what to print<br></td>
<td class="xl69" style="border-left: medium none; width: 118pt;" width="157"> </td>
<td class="xl69" style="border-left: medium none; width: 40pt;" width="53"> </td>
</tr>
<tr style="height: 28.5pt;" height="38">
<td class="xl70" style="height: 28.5pt;" height="38">Case A<br></td>
<td class="xl76" style="border-top: medium none; border-left: medium none;">A <br></td>
<td class="xl71">Special A<br></td>
<td class="xl71" style="border-left: medium none;">G1</td>
<td class="xl71" style="border-left: medium none;">1</td>
</tr>
<tr style="height: 21.75pt;" height="29">
<td class="xl70" style="height: 21.75pt;" height="29">Case B<br></td>
<td class="xl76" style="border-top: medium none; border-left: medium none;">B</td>
<td class="xl71">Special B</td>
<td class="xl71" style="border-left: medium none;">G1</td>
<td class="xl71" style="border-left: medium none;">1</td>
</tr>
<tr style="height: 46.5pt;" height="62">
<td class="xl73" style="height: 46.5pt;" height="62">General case<br></td>
<td class="xl77" style="border-top: medium none; border-left: medium none;"><br></td>
<td class="xl74">normal</td>
<td class="xl74" style="border-left: medium none;">G1</td>
<td class="xl74" 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>