the and isn't  needed for top level facts - so you can just write:

(Customer(grade==Grade.A) or Customer(grade==Grade.B))
Customer(code=="J")

The above should work,it should work even if you had t he && in there. Let me 
know if its  not.

Mark


Régis LOWE wrote:
Thanks Edson,
it works, but I fail to see why it's impossible to combine conditional 
expressions
with drools.

Regis

Edson Tirelli <[EMAIL PROTECTED]> a écrit : Regis,

   If Grade.A and Grade.B are object types, try this:

...
when
customer: Customer( code == "J", gr : grade -> ( gr.equals(Grade.A) || gr.equals(Grade.B) )
then
 ...

   If Grade.A and Grade.B are primitive types:

...
when
customer: Customer( code == "J", gr : grade -> ( ( gr == Grade.A ) || ( gr == Grade.B ) )
then
 ...
Hope it helps.

        Edson


Régis LOWE wrote:

Hi,
can someone explain me how to write the following condition :

(Customer(grade==Grade.A) or Customer(grade==Grade.B))      and   
Customer(code=="J")


the following snippet produces :

unknown:52:66 Unexpected token ')'
Unable to resolve ObjectType '('


rule "discount10"
no-loop true
   when
       #conditions
       customer:  (Customer(grade==Grade.A) or Customer(grade==Grade.B))      and   
Customer(code=="J")
       eval (customer.getTotal()>100000)
then #actions

end


---------------------------------
Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos 
services préférés : vérifiez vos nouveaux mails, lancez vos recherches et 
suivez l'actualité en temps réel. Cliquez ici.



                
---------------------------------
 Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement 
vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et 
suivez l'actualité en temps réel. Cliquez ici.

Reply via email to