[rules-users] using variables in eval

Wolfgang Laun wolfgang.laun at gmail.com
Fri Oct 21 06:32:21 EDT 2011


You cannot assign a value to a bound variable. $c is *bound to *the field
name of a PassThrough fact object.

Assigning values to regular variables can only be done in the consequence,
e.g.,

then
   String s = hello("r");
   ...
end

You can use the modify statement (in the consequence) to change a field of
some fact object.

-W

On 21 October 2011 11:46, rahulkrishnan <rahulkrishnan8 at gmail.com> wrote:

> Hi
>
> 1.i have a rule like this
> rule "Function Call"
> dialect "mvel"
>        when
>                PassThrough( $c : name)
>                eval(($c = hello("rahul"))!=null)
>        then
>                System.out.println($c);
>
> end
>  in this my function will return the string as capital and am entering to
> the consequence part but the $c is printed as null. am not getting what is
> happend.
>
> And if i want to assign the result of function call to a String declared as
> (String s) how can it be done
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/using-variables-in-eval-tp3440419p3440419.html
> Sent from the Drools: User forum 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/20111021/428b850f/attachment.html 


More information about the rules-users mailing list