[rules-users] Reusing Rules across different rule flows

Roger Tanuatmadja rogerst at gmail.com
Fri Jul 25 16:15:56 EDT 2008


Thanks, however I am still not sure how that reuses a certain rule. Or are
you saying I can write another rule just like "pay validation" where:

rule "do something"
no-loop true
       when
               ## Some Rule Matching
       then
               drools.setFocus("rule test 1");
end

.... and that's how I obtain the reuse of "rule test 1"?


Roger





On 7/25/08, Vanina Beraudo <vaninaberaudo at gmail.com> wrote:
>
> It´s a simple example, I have a rule and it call others two rules.
> I hope help you.
>
> rule "rule test 1"
> no-loop true
> agenda-group "rule test 1"
>        when
>                $p:Pay($fields:fields)
>                eval((Double)$fields.get("amount") < 100)
>        then
>                System.out.println( "The amount should be  > 100" );
>        end
>
>
> rule "rule test 2"
> no-loop true
> agenda-group "rule test 2"
>
>        when
>                $p:Pay($fields:fields)
>                eval((Double)$fields.get("amount")> 200)
>        then
>                System.out.println( "The amount should be < 200" );
> end
>
>
> rule "pay validation"
> no-loop true
>        when
>                $p:Pay($fields:fields)
>                eval((Double)$fields.get("amount")> 0)
>        then
>                drools.setFocus("rule test 1");
>                drools.setFocus("rule test 2");
>                System.out.println( "The amount should be in the rank
> [100-200] ");
> end
>
>
>
>
> 2008/7/25 Roger Tanuatmadja <rogerst at gmail.com>:
> > Hi ideally yes, because it makes it easy to show our business users
> what's
> > going on as opposed to having to decipher the flow based on some
> attributes,
> > BUT I am happy to see examples of the use of Agenda as well so if you can
> > provide one that would be great.
> >
> > Thanks again,
> >
> > Roger
> >
> >
> > On 7/25/08, Vanina Beraudo <vaninaberaudo at gmail.com> wrote:
> >>
> >> You are right I don´t use rule flow editor, Do you need work with rule
> >> flow editor?
> >>
> >> 2008/7/25 Roger Tanuatmadja <rogerst at gmail.com>:
> >> > Hi,
> >> >
> >> > Thanks for answering, but that kinda defeats the idea of rule flows
> >> > doesn't
> >> > it? I am assuming with Agenda you don't get to use the rule flow
> editor?
> >> >
> >> > Thanks, and an example would be awesome!!
> >> >
> >> > Roger
> >> >
> >> >
> >> > On 7/25/08, Vanina Beraudo <vaninaberaudo at gmail.com> wrote:
> >> >>
> >> >> Hi, It´s possible using Agenda.
> >> >>
> >> >> please look
> >> >>
> >> >>
> http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html_single/index.html#d0e1111
> >> >>
> >> >> if you want I can give you an example.
> >> >>
> >> >>
> >> >>
> >> >> 2008/7/25 Roger Tanuatmadja <rogerst at gmail.com>:
> >> >> > Hi,
> >> >> >
> >> >> > I've looked at the documentation, and I've tried doing it in the
> IDE,
> >> >> > and
> >> >> > basically I don't think it's possible.
> >> >> > Let's just say I have rule A and I want to reuse it as part of 2
> >> >> > different
> >> >> > rule flows. Is this possible? My guess is no.
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Roger
> >> >> >
> >> >> > _______________________________________________
> >> >> > rules-users mailing list
> >> >> > rules-users at lists.jboss.org
> >> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Lic. Vanina Beraudo
> >> >>
> >> >> _______________________________________________
> >> >> rules-users mailing list
> >> >> rules-users at lists.jboss.org
> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >> >
> >> >
> >> > _______________________________________________
> >> > rules-users mailing list
> >> > rules-users at lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Lic. Vanina Beraudo
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
>
>
> --
> Lic. Vanina Beraudo
>
> _______________________________________________
> 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/20080725/a17a613b/attachment.html 


More information about the rules-users mailing list