[rules-users] How to use for loop in drools!!!!

rouvas at mm.di.uoa.gr rouvas at mm.di.uoa.gr
Tue Apr 19 12:36:05 EDT 2011


Sumeet Karawal wrote:
> Thanks Esteban!!. I got you point. But how to make the rule to run
> according to a condition, in a loop.
>
> Also, how can we trigger the firing of one rule from another rule. Like
> when the Condition part of a rule satisfies then, in the Action part a
> particular rule is triggered and after that the control resumes to the
> previous rule, just as we do in nested if else statement.

You're thinking procedural. You won't go far this way.
Rules based engined require a different way of approaching problems.
Familiarize yourself with these differences and you will find out that in
most cases you do not need loops or "nested" conditions.
The keyword here is predicate logic.

-Stathis

>
>
> Thanks & Regards,
> Sumeet Karawal
> Mailto: sumeet.karawal at tcs.com
>
>
>
>
>   From:       Esteban Aliverti <esteban.aliverti at gmail.com>
>
>   To:         Rules Users List <rules-users at lists.jboss.org>
>
>   Date:       04/19/2011 05:41 PM
>
>   Subject:    Re: [rules-users] How to use for loop in drools!!!!
>
>   Sent by:    rules-users-bounces at lists.jboss.org
>
>
>
>
>
>
> Drools is an inference engine and it let you express your knowledge using
> rules.
> A rule has 2 parts: CONDITION par and ACTION part.
> The CONDITION part is expressed in a drools' proprietary syntax, but in
> the
> ACTION part you can use plain java code.
> What you have described looks like an action that needs to be executed
> when
> certain constraints are meet.
> So, in your case, you can just write those lines in you action part. They
> should work fine.
>
> I recommend you to read the documentation:
> http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html
>
>
> Best Regards,
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Developer @ http://www.plugtree.com
> - Blog @ http://ilesteban.wordpress.com
>
>
> On Tue, Apr 19, 2011 at 3:13 AM, Sumeet Karawal <sumeet.karawal at tcs.com>
> wrote:
>   for(i = 0; i<10; i++)
>   {
>     c.setCustomerCount(c.getCustomerCount() + 1);
>   }
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>





More information about the rules-users mailing list