[rules-users] Arithmetic operator in Condition part (Argent help.....)

Mark Proctor mproctor at codehaus.org
Wed Feb 13 03:06:09 EST 2008


Nikhil_dev wrote:
> Hi!!!, vdelbart,
> thank u for the solution, but is there any way i can run it with moving the
> object 
>
> there is 1 more for which i need a solution
>
> the following Rule dosen't work
>
> package com.vtech.fareengine.module.rulemanagermodule
> import com.vtech.fareengine.module.rulemanagermodule.Bean.ApplyRuleBean;
> rule  "Rule_decimal_1"
> dialect "java"
> when 
>         $a : ApplyRuleBean()  
>          m : ApplyRuleBean ( ($a.AdultFare - $a.InfantFare) < ($a.ChildFare
> + $a.InfantFare) )
>   
that is not valid DRL, you cannot randomly match field constraints and 
arithmatic in that way, you'll have ot put it into an eval. Use the MVEL 
dialect, or change it to a valid jave expression.

         m : ApplyRuleBean ( eval( ($a.AdultFare - $a.InfantFare) < ($a.ChildFare
+ $a.InfantFare) ) )

> then 
>          $a.GrossFare = ($a.ChildFare * 500);
> end
> Follwing is the Error wat i get on compiling :
> sourceDRL :: java.io.StringReader at 1daf835
> [7,36]: unknown:7:36 Unexpected token '-'[7,69]: unknown:7:69 mismatched
> token: [@74,264:264='+',<71>,7:69]; expecting type LEFT_PAREN[7,84]:
> unknown:7:84 mismatched token: [@79,279:279=')',<12>,7:84]; expecting type
> LEFT_PAREN[7,86]: unknown:7:86 mismatched token:
> [@81,281:281=')',<12>,7:86]; expecting type THEN
> java.lang.RuntimeException: Unable to compile drl
>
> is there any solution for this.
>
>   




More information about the rules-users mailing list