[rules-users] Get maximum

Swindells, Thomas TSwindells at nds.com
Mon Jan 24 04:27:23 EST 2011


You probably want something like this:

Rule "multiplePeople"
        p1 : Person()
        not Person (age > p1.age)
        not OldestPerson()
then
        insert (new OldestPerson(p1))
end

The oldest person is the person for whom there isn't someone older.
If there are multiple oldest people of the same age this will pick one arbitrarily.
You may want insertLogical if your people can be updated/inserted.

Thomas


> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of nemo
> Sent: 24 January 2011 09:13
> To: rules-users at lists.jboss.org
> Subject: [rules-users] Get maximum
>
>
> Hi all,
>
> I'm a newbie here and have a problem which seems to be quite simple, but  I
> just can't solve it. I have a set of  peoples with the attribute age and
> want to get the oldest person from these set. I would really appreciate, if
> somebody tells me how can I do it with jdrools.
> --
> View this message in context: http://drools-java-rules-
> engine.46999.n3.nabble.com/Get-maximum-tp2318296p2318296.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


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************




More information about the rules-users mailing list