try:
when
RuleParam(changeReason=="MA") ||
RuleParam(changeReason=="CM")
RuleParam(p:healthPlan!="blank") &&
RuleParam(healthPlan!="refused")
ICoverage(healthPlan != p)
then
System.out.println("result = " + p);
On 4/16/06, Liang Gao <[EMAIL PROTECTED]> wrote:
>
> I am new to Drools 3. My DRL dile is compiled and the test program runs
> well, however, the result is NOT my expectation. According to the input, it
> should output "Result = error1", but it print NOTHING.
>
> It works if I change lines <1> and <2> of the drl file to:
> ICoverage(healthPlan!="plan2"). So I guess the problem should come from
> "RuleParam(p:healthPlan)". I have checked the documentation of Drools 3 and
> the testing code in
> http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/not_with_bindings_rule_test.drl.
> But
> I didn't find out the reason.
>
> Does anybody know why? The following is my source code that runs on
> Drools3 RC2.
>
> Thanks a lot.
>
> Liang
>
>
> ===========================================================================================
>
> My drl file:
>
> -------------------------------------------------------------------------------------------
> package gov.sc.eip.rules;
> #generated from Decision Table
> import java.lang.String;
> import gov.sc.eip.model.ICoverage;
> import gov.sc.eip.helper.IConstants;
> import gov.sc.eip.rules.test.RuleParam;
>
> #From row number: 14
> rule "HealthRules_14"
>
> salience 65522
> when
> RuleParam(changeReason=="MA") ||
> RuleParam(changeReason=="CM")
> RuleParam(healthPlan!="blank") &&
> RuleParam(healthPlan!="refused")
> <1> RuleParam(p:healthPlan)
> <2> ICoverage(healthPlan!=p)
> then
> System.out.println("result = " + "error1");
> end
> ---------------------------------------- drl end
> ------------------------------------------
>
> Snippet of Test program
>
> -------------------------------------------------------------------------------------------
> ICoverage coverage = new Coverage();
>
> //paremeter
> RuleParam params = new RuleParam();
> params.setChangeReason("MA");
> params.setHealthPlan("plan2");
>
> //ICoverage object
> coverage.setHealthPlan("plan1");
>
> t.engine = t.ruleBase.newWorkingMemory();
> t.engine.assertObject(params);
> t.engine.assertObject(coverage);
>
> t.engine.fireAllRules();
>
> ---------------------------------------------------------------------------------------------
>
>
>
>
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference