[rules-users] Error using forAll() in rules

Wolfgang Laun wolfgang.laun at gmail.com
Thu Jun 10 16:47:31 EDT 2010


Your description of what you think you have to do does not agree with much
of the code you show.

- The rule name says that is depends on A.name == "bob", which isn't in the
condition.
- The RHS setA( $a.getName() ) is obviusly in error because B.a is an A, not
a String.
- Why should B be modified, if the change only concerns A.name.

It is sufficient to change A.name. All Bs referencing that one A will
continue to reference the modfied A.

-W


2010/6/10 Fnu Mahalakshmi <FMahalakshmi at nyx.com>

>  Hi,
>
> I have a list of items which I want to modify if condition turns true. I
> tried forall but its not working::
>
>
>
> A{
>
> String Name
>
> }
>
> B{
>
> A a,
>
> }
>
>
>
> Rule “ modify B if A name = ‘bob’”
>
> *when*
>
>             *forall*($a : A()
>
>                   $b : B( a == $a)
>
>                   )
>
>       *then*
>
>             modify($b){
>
>             seta($a.getName())};
>
> I have many B objects pointing to same A object and when name of A is
> modified I want the rule to fire and all B to also be modified.
>
>
>
> What is wrong above???
>
> I tried this too:
>
> *when*
>
>             *forall*($a : A()
>
>                   B( a == $a)
>
>                   )
>
>       *then*
>
>             modify($b){       // but then I cannot do this step.which is
> required
>
>             seta($a.getName())};
>
>
>
> Any Idea???
>
>
>
>
>
> Thank you
>
> M
>
>
>
> ------------------------------
>
> *Please consider the environment before printing this email.*
>
> *Visit our website at http://www.nyse.com
> *****************************************************************************
>
> Note: The information contained in this message and any attachment to it is
> privileged, confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient, you are
> hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify the sender immediately by replying to
> the message, and please delete it from your system. Thank you. NYSE
> Euronext. *
>
>
> _______________________________________________
> 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/20100610/a2d0ebcf/attachment.html 


More information about the rules-users mailing list