On 8 August 2011 10:02, wutongjoe <wutongjoe@gmail.com> wrote:
hello all,

I am a newbi on Drools and started my test work with a modified exapmle
included in drools v4.0.7.The compiled drl from a very simple modified  xls
file is like the follwing :


----------------------code-----------------------
package org.drools.examples.decisiontable;
#generated from Decision Table
import org.apache.commons.lang.time.DateUtils;
import java.util.Date;
#From row number: 11
rule "Pricing bracket_11"

       when
               DateUtils.SEMI_MONTH==1001

This looks very wrong. The result of compiling a correct decision table should look like
    SomeFactName( someFieldName == 1001)
 
       then
               policy.setBasePrice(9999999);

Where does the variable "policy" come from? It isn't bound to anything.
 
end
-------------------------code---------------------

but I got an exception stack when trying to addPackage after compile :

--------------stack----------------
Exception in thread "Main Thread" org.drools.rule.InvalidRulePackage:
[9,22]: unknown:9:22 mismatched token: [@46,221:222='==',<76>,9:22];
expecting type LEFT_PAREN
       at org.drools.rule.Package.checkValidity(Package.java:424)
       at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
       at
org.drools.examples.PricingRuleDTExample.buildRuleBase(PricingRuleDTExample.java:67)
       at
org.drools.examples.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:38)
       at
org.drools.examples.PricingRuleDTExample.main(PricingRuleDTExample.java:26)
--------------stack----------------

yes,I was trying to test the usage of org.apache.commons.lang.time.DateUtils
inside a xls file,but it seemed something went wrong.
 
Spreadsheets over xls are not a convenient vehicle for testing conditional expressions or rule patterns in general. Write some DRL rules for this purpose.

 
Can someone tell me
what caused the exception?

Syntax errors. Make sure to read the documentation on spreadsheets; how to define a Fact type for a conditional element (a "pattern") and how to add constraints to it.

-W
 
thanks a lot



--
View this message in context: http://drools.46999.n3.nabble.com/a-newbi-question-tp3234838p3234838.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users