[rules-users] Get a value in "when" clause and use it in "then" clasuse

Wolfgang Laun wolfgang.laun at gmail.com
Sat Feb 6 03:45:22 EST 2010


There is no way to do what you want. Evaluation of CEs happens at
one time, and executing the Consequence is done anytime later.

Just call validarNumeroCuenta again in the consequence. If it
is very costly, you might consider implementing a
memoization<http://en.wikipedia.org/wiki/Memoization>
technique.

-W

On Fri, Feb 5, 2010 at 9:07 PM, YamilBracho <yamilbracho at hotmail.com> wrote:
>
> Hi
> I have this rule in my drl file :
>
> rule "cuentaOrigen Numerico 20 digitos y Modulo 11"
>   when
>     $detalle : ArchivoDetalleBean( msg=
> eval(!ValidationUtils.validarNumeroCuenta(cuentaOrigen)) );
>   then
>     errorList.add(new ErrorPlugInBean(1, msg));
> end
>
> I would like to get the "msg" String var and use it in the "then" clasuse
> validarNumeroCuenta() ia a method that return a string
>
> How can I do that ?
>
> TIA
> Yamil
> --
> View this message in context:
http://n3.nabble.com/Get-a-value-in-when-clause-and-use-it-in-then-clasuse-tp185076p189285.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> 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/20100206/97925bc7/attachment.html 


More information about the rules-users mailing list