[rules-users] Formula value assginment in LHS

Premkumar Stephen prem18 at gmail.com
Fri Jul 3 07:49:35 EDT 2009


How are you executing the rules? Are you using web services via the Drools
execution server? because, I have seen multiple firings in this scenario.

Regards,
Prem


2009/7/2 Shabbir Dhari <sdhari at hotmail.com>

>  Dear all
>
> We are developing a financial business application that contains hundreds
> of business rules for validations and calculations. In the calculation rules
> we change the value of attribute if values past in the request is incorrect
> e.g.
>
> rule "TaxCalc"
>     when
>          $i : Invoice()
>          Invoice (totalTax != (round(salesTax + (gstRate * salesAmount /
> 100) + importDuty – govtRebate, 2)))
>     then
>          i.setTotalTax(round(salesTax + (gstRate * salesAmount / 100) +
> importDuty – govtRebate, 2));
> end
>
> The above code works perfectly fine. Only problem is the perform
> calculation twice. What I was looking if possible I can store calculated tax
> in a variable and simply assign variable to attribute if rule condiation
> fails. Some thing like:
>
> rule "TaxCalc"
>     when
>         $i : Invoice()
>         Invoice (totalTax != calTax : (round(salesTax + (gstRate *
> salesAmount / 100)+ importDuty – govtRebate, 2)))
>     then
>         i.setTotalTax(calTax);
>     end
>
> But this does not work - shows system error at calculated value assignment.
> Is there any work around?
>
>
> ------------------------------
> Click here to find out more POP access for Hotmail is here!<http://windowslive.ninemsn.com.au/article.aspx?id=802246>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090703/7a1e643c/attachment.html 


More information about the rules-users mailing list