[rules-users] Unable to perform simple primitive operations

Edson Tirelli tirelli at post.com
Wed Jul 18 06:45:08 EDT 2007


   Natraj,

   What you described are all limitations of drools 3. They are all solved
now in drools 4, but not much we can do in 3.

   []s
   Edson

2007/7/18, Natraj Gudla <natraj.forums at gmail.com>:
>
> Hi All,
>
> I am using Drools 3.0.6 and unable to perform some simple form of
> multiplication. I want to compare an object field with another field
> multiplied by a factor.
>
> *
>
> rule
> * "*Calculate* Business profit,1"
> *when
>
> * *EMIAgainstProperty* ( bp1 : businessProfit1 )
> emi : *EMIAgainstProperty* ( businessProfit2 > *(bp1*1.5)* )
>
> *then
> *emi.setBusinessProfit((emi.getBusinessProfit1
> ()+emi.getBusinessProfit2())/2);*
> ** end*
>
> I get an error on creation of the package that * is undefined for Double
> and double. I understand this is because Drools does an auto box on
> primitive type variables. But is there a work around to do simpler
> comparisons like this, especially on the right hand side of the condition.
> some thing like [ variable * constantValue ].
>
> Also, i am forced to do a declaration for businessProfit1, and use in the
> comparison below. I am not able to compare two fields of the same object
> directly.
>
> some thing like businessProfit2 > businessProfit1 does not work, why is
> this so? Any one has faced these problems earlier?
>
> Thanks
> Natraj
>
> _______________________________________________
> 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 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070718/80b7572f/attachment.html 


More information about the rules-users mailing list