[rules-users] eval question

Marcus Ilgner marcus.ilgner at gmail.com
Wed Jun 4 10:49:55 EDT 2008


Hi Mike,

On Wed, Jun 4, 2008 at 3:53 PM, Mike D <mike.dalaker at kewill.com> wrote:
>
> I'm close, but no cigar...
>
> I have a header record amount and did an accumulate on a detail amount.  The
> sum of the detail can be within a percent of the total.
>
> The $valueUsAmt is the header, and the totValue is the sum of lines...
> What I need to do is to take the valueUsAmt * .0001 and if that is >= the
> abs value, all is good.
>
> eval($valueUsAmt.subtract($totValue).abs().compareTo(???) <= 0)
>
> It's the * .0001 that is giving me the problem.  Any help would be
> appreciated.
>
> Thanks!

Have you tried compareTo(new Float($valueUsAm*0.0001f)) ?
I'm not 100% percent sure if this is faster, but eventually you could even use
Number(intValue < 0) from
$valueUsAmt.subtract($totValue).abs().compareTo(new
Float($valueUsAm*0.0001f))

Hope that helps
Marcus



More information about the rules-users mailing list