[rules-users] Use of the binding variable

Esteban Aliverti esteban.aliverti at gmail.com
Thu May 9 09:22:25 EDT 2013


What you have described is half of the usage of binding variables. You can
bind a variable to a fact or to individual fields of a fact. You can then
use those variables in the LHS or the RHS of your rules.
For example:

1.- Find different Person objects

when
  $p1: Person($name1: name)
  $p2: Person($name2: name, *this != $p1*)
then
  System.out.println("Found "+$p1+" with name '"+$name1+"' and "+$p2+" with
name '"+$name2+"'");
end

Regards,



XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com


On Thu, May 9, 2013 at 3:08 PM, IPatel <ishita.patel at usbank.com> wrote:

> Hi,
>
> I am having little bit difficulty in understanding  "binding variable"
> concept in the guvnor. During our POC a business user asked me question
> around this and i was able to save myself by telling them that the binding
> variable is used in case you want use the fact again in Then statement.
> (This is how i see it in the examples of rules).
>
> Can anyone please explaining me the real use of the binding variable so
> that
> i can help my business partner understand it properly?
>
> Thank you for your help in advance
>
> Isha
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Use-of-the-binding-variable-tp4023744.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/20130509/1a7d0e13/attachment.html 


More information about the rules-users mailing list