[rules-users] Error using forAll() in

Fnu Mahalakshmi FMahalakshmi at nyx.com
Thu Jun 10 17:21:34 EDT 2010


Hi,

Thanks for the prompt response.
I just broke the information into 2 separate rules and it works great.
In 1 I modified it to check if the value of B is modified then that A value is modified
In the 2 rule I checked if A is modified then all the Bs referencing A is modified.
Removed the forAll completely.
Thanks for the help :)

-M
-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: Thursday, June 10, 2010 4:48 PM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 43, Issue 58

Send rules-users mailing list submissions to
	rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
	rules-users-request at lists.jboss.org

You can reach the person managing the list at
	rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

   1. Error using forAll() in rules (Fnu Mahalakshmi)
   2. Re: Error using forAll() in rules (Wolfgang Laun)


----------------------------------------------------------------------

Message: 1
Date: Thu, 10 Jun 2010 16:16:47 -0400
From: Fnu Mahalakshmi <FMahalakshmi at nyx.com>
Subject: [rules-users] Error using forAll() in rules
To: "'rules-users at lists.jboss.org'" <rules-users at lists.jboss.org>
Message-ID:
	<994758E35590274E955FA75763C5AA5002D010C6 at MTEXMBXP01.ad.NYX.com>
Content-Type: text/plain; charset="us-ascii"

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

</pre>

<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>

*****************************************************************************
<br>
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.

</STRONG></P><pre>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100610/874f04c7/attachment-0001.html 

------------------------------

Message: 2
Date: Thu, 10 Jun 2010 22:47:31 +0200
From: Wolfgang Laun <wolfgang.laun at gmail.com>
Subject: Re: [rules-users] Error using forAll() in rules
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<AANLkTimXe7FoIGmku_PMF5cKg86Qb3yxXfuSFIHa2Mfs at mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"

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 

------------------------------

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 43, Issue 58
*******************************************
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.





More information about the rules-users mailing list