On 8 August 2011 10:02, wutongjoe <span dir="ltr">&lt;<a href="mailto:wutongjoe@gmail.com">wutongjoe@gmail.com</a>&gt;</span> wrote:<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;">
hello all,<br>
<br>
I am a newbi on Drools and started my test work with a modified exapmle<br>
included in drools v4.0.7.The compiled drl from a very simple modified  xls<br>
file is like the follwing :<br>
<br>
<br>
----------------------code-----------------------<br>
package org.drools.examples.decisiontable;<br>
#generated from Decision Table<br>
import org.apache.commons.lang.time.DateUtils;<br>
import java.util.Date;<br>
#From row number: 11<br>
rule &quot;Pricing bracket_11&quot;<br>
<br>
        when<br>
                DateUtils.SEMI_MONTH==1001<br></blockquote><div><br>This looks very wrong. The result of compiling a correct decision table should look like<br>    SomeFactName( someFieldName == 1001)<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

        then<br>
                policy.setBasePrice(9999999);<br></blockquote><div><br>Where does the variable &quot;policy&quot; come from? It isn&#39;t bound to anything.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

end<br>
-------------------------code---------------------<br>
<br>
but I got an exception stack when trying to addPackage after compile :<br>
<br>
--------------stack----------------<br>
Exception in thread &quot;Main Thread&quot; org.drools.rule.InvalidRulePackage:<br>
[9,22]: unknown:9:22 mismatched token: [@46,221:222=&#39;==&#39;,&lt;76&gt;,9:22];<br>
expecting type LEFT_PAREN<br>
        at org.drools.rule.Package.checkValidity(Package.java:424)<br>
        at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)<br>
        at<br>
org.drools.examples.PricingRuleDTExample.buildRuleBase(PricingRuleDTExample.java:67)<br>
        at<br>
org.drools.examples.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:38)<br>
        at<br>
org.drools.examples.PricingRuleDTExample.main(PricingRuleDTExample.java:26)<br>
--------------stack----------------<br>
<br>
yes,I was trying to test the usage of org.apache.commons.lang.time.DateUtils<br>
inside a xls file,but it seemed something went wrong.</blockquote><div> </div><div>Spreadsheets over xls are not a convenient vehicle for testing conditional expressions or rule patterns in general. Write some DRL rules for this purpose.<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;">Can someone tell me<br>
what caused the exception?</blockquote><div><br>Syntax errors. Make sure to read the documentation on spreadsheets; how to define a Fact type for a conditional element (a &quot;pattern&quot;) and how to add constraints to it.<br>
<br>-W<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> thanks a lot<br>
<font color="#888888"><br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.html" target="_blank">http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>