[rules-users] bounded variable...

Edson Tirelli tirelli at post.com
Wed Jan 10 14:06:53 EST 2007


  Joel,

  In 3.0.x, you can not use inside a predicate, any other variable bound 
in the same pattern, besides the one that is bound to the predicate. To 
do that, you need to use an eval:

rule "modem_warranty_menu"
    when       
        megaTO:MegaTransferObject(other_EffectiveOrderTypeDsl == 
Constants.NEW_COMPLETED_ORDER_TYPE,  at:other_IsAdaAltaTraslado, 
nm:orders_NewModem )
       eval( nm.equals(Constants.FLAG_YES) || 
(nm.equals(Constants.FLAG_NO) && at.equals(Constants.FLAG_YES)) )
    then
        menu.add(new String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL, 
Constants.SERVICE_ASSURANCE_MENU_WARRANTY});
end

    Seems you are doing great in pushing the limitations of drools 3.0. :)
    This is also a limitation that is already solved in trunk for the 
next release.

    []s
    Edson


Joel G. Rivera-González wrote:

> rule "modem_warranty_menu"
>     when       
>         megaTO:MegaTransferObject(other_EffectiveOrderTypeDsl == 
> Constants.NEW_COMPLETED_ORDER_TYPE,
>         at:other_IsAdaAltaTraslado, nm:orders_NewModem -> 
> (nm.equals(Constants.FLAG_YES) || (nm.equals(Constants.FLAG_NO) && 
> at.equals(Constants.FLAG_YES))))
>     then
>         menu.add(new 
> String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL, 
> Constants.SERVICE_ASSURANCE_MENU_WARRANTY});
> end
>
> this rule cause a compilation error...
> the reason appears to be at:other_IsAdaAltaTraslado,
> why it doesnt allow me to have 2 bounded variables on the same rule?
>  
> Joel G. Rivera-Gonzalez
> PRT
>
> "The first 90% of a project takes 90% of the time, the last 10% takes 
> the other 90% of the time" - Murphy's Law
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list