[rules-users] if else implementation in one rule

Wolfgang Laun wolfgang.laun at gmail.com
Thu Sep 9 02:54:01 EDT 2010


An else in a rule doesn't make sense, because the LHS can be false for any
number of reasons, in your example:
  - no employee at all
  - an employee not in state MH

If you want this to be in a single rule you'll have to have only one action
that's executed when the LHS matches.

You know that you can code any RHS actions in a DRL function (or a Java
static or non-static method) and call these from different RHS?

But if you are hell-bent on doing it in a single rule, use a Java if
statement on the RHS.

-W



2010/9/9 Kripa Nathwani <Kripa.Nathwani at lntinfotech.com>

>  Hello,
>
>
>
> I need to implement a functionality as follows:
>
> If an employee belongs to a particular state(MH) for a particular
> month(Feb) then take an action.
>
> If an employee belongs to the same state(MH) but for different month (non
> Feb) then take another action.
>
> I can implement it using two different rules(Feb rule and nonFeb rule). BUT
> if I want to implement it using a single rule is there any provision for the
> same in Drools?
>
> Similar to an if-then-else statement in java.
>
>
>
> Best Regards,
>
> Kripa
>
>
>
> ------------------------------
> This Email may contain confidential or privileged information for the
> intended recipient (s) If you are not the intended recipient, please do not
> use or disseminate the information, notify the sender and delete it from
> your system.
>
> ______________________________________________________________________
>
> _______________________________________________
> 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/20100909/35f9e9ca/attachment.html 


More information about the rules-users mailing list