2011/9/12 Swindells, Thomas <span dir="ltr">&lt;<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>&gt;</span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">






<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">If you dump out the xml </span></p></div></div></blockquote><div><br>Why XML?<br> import org.drools.decisiontable.SpreadsheetCompiler;<br><br> private void testSpreadsheet(){<br>
    File dtf = new File( dtPath );<br>    InputStream is;<br>    try {<br>      is = new FileInputStream( dtf );<br>      SpreadsheetCompiler ssComp = new SpreadsheetCompiler();<br>      String s = ssComp.compile( is, InputType.XLS );<br>
      System.out.println( &quot;=== Begin generated DRL ===&quot; );<br>      System.out.println( s );<br>      System.out.println( &quot;=== End generated DRL ===&quot; );<br>    } catch (IOException e) {<br>      e.printStackTrace();<br>
    }<br>  }<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">
<span style="font-size: 11pt; color: rgb(31, 73, 125);">it converts the spreadsheet to you can see what the resulting DRL is.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Mantis is right in what the output is – if you don’t merge the condition column you’ll get a drl as below (If there exists a Condition (c1) such that its payment
 &gt; $param(1) AND there exists a Condition (c2) such that its payment &lt;= $param(2).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">If you merge the condition column the constraints apply to the same Condition object with the comma being the implicit and (if there exists a Condition c1 such
 that its payment &gt; $param(1) AND its payment &lt;= $param(2).</span></p></div></div></blockquote><div><br>All correct, but the problem with this approach is the necessity of providing identical values in two places - once as an upper limit and once as a lower limit. By using the keyword &quot;Sequential true&quot; rules will be made to fire from top to bottom. Adding a uniform constraint that guarantees that the value-to-be-set hasn&#39;t been set yet (==null), a single constraint using the value as an upper limit is sufficient.<br>
<br>-W <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">
<span style="font-size: 11pt; color: rgb(31, 73, 125);"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thomas<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"><u></u> <u></u></span></p>
<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0cm 0cm 0cm 4pt;">
<div>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>]
<b>On Behalf Of </b>john@oa<br>
<b>Sent:</b> 09 September 2011 16:28<br>
<b>To:</b> <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<b>Subject:</b> Re: [rules-users] Spreadsheet: Rule Compilation error (xxx) cannot be resolved: Keeping running total<u></u><u></u></span></p>
</div>
</div><div><div></div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-bottom: 12pt;">Thanks Manstis<br>
<br>
Actually I found that the issue was caused by me having incorrectly placed the &quot;RuleTable&quot; statement in the spreadsheet, I believe the CONDITION&#39;s in the columns are by default: AND joined.<u></u><u></u></p>

<div>
<p class="MsoNormal">On Fri, Sep 9, 2011 at 3:57 PM, manstis [via Drools] &lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=3323194&amp;i=0" target="_blank">[hidden email]</a>&gt; wrote:<u></u><u></u></p>
<p class="MsoNormal" style="margin-bottom: 12pt;">Does your &quot;Condition&quot; span the two columns with the payment $param? e.g.<br>
 <br>
<span style="font-family: &quot;Courier New&quot;;">|             Condition              | <br>
|-----------------+------------------|<br>
|payment &gt; $param | payment &lt;= $param|<br>
|-----------------+------------------|</span><br>
<br>
Otherwise you are creating rules that check the following:-<br>
<br>
<span style="font-family: &quot;Courier New&quot;;">when<br>
Condition(payment &gt; )<br>
then<br>
...<br>
<br>
when<br>
Condition(payment &gt; 1000)<br>
then<br>
...<br>
</span><br>
Whereas you really require:-<br>
<br>
<span style="font-family: &quot;Courier New&quot;;">when<br>
Condition(payment &gt;0, payment &lt;= 1000)<br>
then<br>
...</span><br>
<br>
etc<u></u><u></u></p>
<div>
<p class="MsoNormal">2011/9/9 john@oa &lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=3323110&amp;i=0" target="_blank">[hidden email]</a>&gt;<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">Thanks Iaune<br>
<br>
That is really helpful.  Yes, I need the ranges to be mutually exclusive, what is the easiest way to do that?  Feel a bit cheeky asking another question, but you seem to know what you are talking about! I have tried adding two conditions to enforce the range,
 but that doesn&#39;t seem to work - see below.  I still get multiple rules firing.  Also can you recommend any good resources for learning all of this, apart from the online documentation?  Would you know if any of the Drools books are any good?<u></u><u></u></p>

<table style="width: 321pt;" width="428" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; width: 161pt; min-height: 15pt;" width="215">
<p class="MsoNormal">payment &gt; $param<u></u><u></u></p>
</td>
<td style="padding: 0cm; width: 161pt; min-height: 15pt;" width="215">
<p class="MsoNormal">payment &lt;= $param<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">Payment Greater Than<u></u><u></u></p>
</td>
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">Payment Less Than or Equal To<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;"></td>
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">0<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">0<u></u><u></u></p>
</td>
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">1500<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">1500<u></u><u></u></p>
</td>
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">2000<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">2000<u></u><u></u></p>
</td>
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">3000<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">3000<u></u><u></u></p>
</td>
<td style="padding: 0cm; min-height: 15pt;">
<p class="MsoNormal">4000<u></u><u></u></p>
</td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;"></td>
<td style="padding: 0cm; min-height: 15pt;"></td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;"></td>
<td style="padding: 0cm; min-height: 15pt;"></td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;"></td>
<td style="padding: 0cm; min-height: 15pt;"></td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;"></td>
<td style="padding: 0cm; min-height: 15pt;"></td>
</tr>
<tr style="min-height: 15pt;">
<td style="padding: 0cm; min-height: 15pt;"></td>
<td style="padding: 0cm; min-height: 15pt;"></td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin-bottom: 12pt;"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">On Fri, Sep 9, 2011 at 2:22 PM, laune [via Drools] &lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=3323074&amp;i=0" target="_blank">[hidden email]</a>&gt; wrote:<u></u><u></u></p>
</div>
<blockquote style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); border-width: medium medium medium 1.5pt; padding: 0cm 0cm 0cm 12pt; margin-top: 5pt; margin-bottom: 5pt;">

<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">The error you get is due to the second condition (application: Application()) not being included in the generated rules. Empty cell means: the column&#39;s snippet is not included in the rule.
<br>
<br>
Since you don&#39;t have a constraint for Application() you can employ a trick: remove the column and prefix the text application: Application() to the text in cell C7.<br>
<br>
In Rule 1, do you really want to test whether a payment is not greater than zero?<br>
<br>
Do you realize that Rules 2 and 3 would both fire for certain payment amounts?<br>
<br>
You can update a String field. To concatenate, use<br>
   x.setString( x.getString() + &quot;whatever&quot; );<br>
<br>
-W<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">On 9 September 2011 14:08, john@oa &lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=3322896&amp;i=0" target="_blank">[hidden email]</a>&gt; wrote:<u></u><u></u></p>
</div>
<blockquote style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); border-width: medium medium medium 1.5pt; padding: 0cm 0cm 0cm 12pt; margin-top: 5pt; margin-bottom: 5pt;">

<div>
<p class="MsoNormal">Guvnor: guvnor-5.2.0.Final-tomcat-6.0<br>
<br>
Hi<br>
<br>
I am a Drools Newbie and I have an integer field called score that I need to<br>
add to when a rule matches in a spreadsheet decision table.  i.e. the score<br>
field should hold a running total of all scores that are matched.  However,<br>
I can&#39;t even update the field in the table.  I have attached the spreadsheet<br>
for review.  In this spreadsheet I am simply trying to set the score, and<br>
that is failing with:<br>
<br>
DScoringTable] Rule Compilation error application cannot be resolved<br>
<br>
My goal is to have different decision tables that will all need to update<br>
the same score, and keep a running total of the total score.<br>
<br>
Any help very much appreciated!  I hope that I am just missing something<br>
obvious.<br>
<a href="http://drools.46999.n3.nabble.com/file/n3322713/demo-score-sheet.xls%0Ademo-score-sheet.xls" target="_blank">http://drools.46999.n3.nabble.com/file/n3322713/demo-score-sheet.xls<br>
demo-score-sheet.xls</a><br>
<br>
In future I may wish to also update a String field and keep concatenating to<br>
that field, is this possible?<br>
<br>
John<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color: rgb(136, 136, 136);"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3322713.html" target="_blank">
http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3322713.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span style="color: rgb(136, 136, 136);"><a href="http://user/SendEmail.jtp?type=node&amp;node=3322896&amp;i=1" target="_blank">[hidden email]</a><u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="color: rgb(136, 136, 136);"><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><u></u><u></u></span></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br>
_______________________________________________ <br>
rules-users mailing list <br>
<a href="http://user/SendEmail.jtp?type=node&amp;node=3322896&amp;i=2" target="_blank">[hidden email]</a>
<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<u></u><u></u></p>
</div>
<div class="MsoNormal" style="text-align: center;" align="center">
<hr style="color: rgb(204, 204, 204);" noshade size="1" width="100%" align="center">
</div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size: 9pt; color: rgb(68, 68, 68);">If you reply to this email, your message will be added to the discussion below:<u></u><u></u></span></b></p>
</div>
<p class="MsoNormal"><span style="font-size: 9pt; color: rgb(68, 68, 68);"><a href="http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3322896.html" target="_blank">http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3322896.html</a>
<u></u><u></u></span></p>
</div>
<div style="margin-top: 4.8pt;">
<p class="MsoNormal"><span style="font-size: 8.5pt; color: rgb(102, 102, 102);">To unsubscribe from Spreadsheet: Rule Compilation error (xxx) cannot be resolved: Keeping running total, click here.
<u></u><u></u></span></p>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><u></u> <u></u></p>
</div>
</div>
<div class="MsoNormal">
<hr style="width: 225pt;" size="2" width="300" align="left">
</div>
<p class="MsoNormal">View this message in context: <a href="http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3323074.html" target="_blank">
Re: [rules-users] Spreadsheet: Rule Compilation error (xxx) cannot be resolved: Keeping running total</a><u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal"><br>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html" target="_blank">
Drools: User forum mailing list archive</a> at Nabble.com.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="http://user/SendEmail.jtp?type=node&amp;node=3323110&amp;i=1" target="_blank">[hidden email]</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><br>
<br>
_______________________________________________ <br>
rules-users mailing list <br>
<a href="http://user/SendEmail.jtp?type=node&amp;node=3323110&amp;i=2" target="_blank">[hidden email]</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>
<u></u><u></u></p>
<div class="MsoNormal" style="text-align: center;" align="center">
<hr style="color: rgb(204, 204, 204);" noshade size="1" width="100%" align="center">
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size: 9pt; color: rgb(68, 68, 68);">If you reply to this email, your message will be added to the discussion below:<u></u><u></u></span></b></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size: 9pt; color: rgb(68, 68, 68);"><a href="http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3323110.html" target="_blank">http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3323110.html</a>
<u></u><u></u></span></p>
</div>
<div>
<div>
<div style="margin-top: 4.8pt;">
<p class="MsoNormal"><span style="font-size: 8.5pt; color: rgb(102, 102, 102);">To unsubscribe from Spreadsheet: Rule Compilation error (xxx) cannot be resolved: Keeping running total,
<a>click here</a>. <u></u><u></u></span></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><u></u> <u></u></p>
<div class="MsoNormal">
<hr style="width: 225pt;" size="2" width="300" align="left">
</div>
<p class="MsoNormal">View this message in context: <a href="http://drools.46999.n3.nabble.com/Spreadsheet-Rule-Compilation-error-xxx-cannot-be-resolved-Keeping-running-total-tp3322713p3323194.html" target="_blank">
Re: [rules-users] Spreadsheet: Rule Compilation error (xxx) cannot be resolved: Keeping running total</a><br>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html" target="_blank">
Drools: User forum mailing list archive</a> at Nabble.com.<u></u><u></u></p>
</div></div></div>
</div>
<br>
<hr>
<font face="Arial" size="1" color="Gray"><br>
**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com" target="_blank">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data
 may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
</font>
</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>