[rules-users] Rule error

Vincent Legendre vincent.legendre at eurodecision.com
Wed Jul 13 08:41:28 EDT 2011


Don't put that in a eval, but directly in the second pattern 
constraints, like this :

rule "ValidMechanism"
	when
		$c : Capacity(doMin>20)
		$m : Mechanism(*doMin<= $c.doMin,*
  DMOMax<=30, doMax>50&&  doMin<40&&  maxPower>180&&
minPower>=100&&  bidPower>100&&  <200)
	then
		System.out.println("Capacity n°"+$c.getIdCapacity()+" eligible to the
mechanism n°"+$m.getIdMechanism()+" for rule 1" );
end



Le 13/07/2011 14:34, FrankVhh a écrit :
> Hi,
>
> It depends upon which version of drools you are using, but if it is a
> version pre 5.2.0, than your last line should be:
>
> eval($c.getDoMin()>=$m.getDoMin())
>
> If you are using 5.2.0, the parser allow a bit more freedom, allthough I am
> not sure about this very case. You surely will have to omit the ; at the end
> of your condition.
>
> Regards,
> Frank
>
>
> michou89 wrote:
>> rule "ValidMechanism"
>> 	when
>> 		$c : Capacity(doMin>20)
>> 		$m : Mechanism(DMOMax<=30, doMax>50&&  doMin<40&&  maxPower>180&&
>> minPower>=100&&  bidPower>100&&  <200)
>> 		$c.getDoMin()>=$m.getDoMin();
>> 	then
>> 		System.out.println("Capacity n°"+$c.getIdCapacity()+" eligible to the
>> mechanism n°"+$m.getIdMechanism()+" for rule 1" );
>> end
>>
>>
>> My error : org.drools.rule.InvalidRulePackage: [40,15]: unknown:40:15
>> mismatched token: [@100,813:814='>=',<78>,40:15]; expecting type THEN
>> (this is the last line before the "then")
>>
>>
>> I don't understand why I can't compare 2 values.
>>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Rule-error-tp3162619p3165771.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


-- 
Vincent LEGENDRE
/Consultant Sénior/

EURODECISION
9A rue de la Porte de Buc 78000 VERSAILLES
Tél. : +33 (0)1 39 07 12 40
Direct : +33 (0)1 39 07 26 16
www.eurodecision.com
EURODECISION <http://www.eurodecision.com/><http://www.eurodecision.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110713/f3772920/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logoED.gif
Type: image/gif
Size: 3345 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20110713/f3772920/attachment.gif 


More information about the rules-users mailing list