[rules-users] Can we fire a rule from another rule...?

Wolfgang Laun wolfgang.laun at gmail.com
Fri Dec 4 04:13:39 EST 2009


I have some reservations w.r.t. the proposed solution. One has to assume
that "Rule 2" is there (and should continue to be so) to fire when its
condition is true, irrespective of what goes on due to "Rule 1". The only
way to do this is by writing
   InsertedFact()
   or
   condition-of-rule2()
and this would make any bindings in condition-of-rule2() unusable in the
rule's consequence.

If by "firing" is meant that the RHS of Rule 2 is to be executed, simply add
the statements of the consequence to the ones of Rule 1. (Wrapping it in a
function avoids code duplication.)

-W



2009/12/4 Ross H <rossh00 at gmail.com>

> Insert a new fact that causes Rule 2 to fire. That way you can decouple
> your logic and gain more flexibility to add more rules based on this new
> fact.
>
> 2009/12/4 Deepak Jambhekar <deepak.jambhekar at tcs.com>
>
>> Hi...
>>        In one of my requirments I need to fire a rule from another rule...
>> i.e.
>>  when
>>       rule "Rule 1"
>>
>> when
>>
>> condition()
>>
>> then
>>
>>       someaction()
>>
>>       then it should fire another rule Rule2
>>
>> end
>>
>>           rule "Rule 2"
>>
>> when
>>
>>  condition()
>>
>> then
>>
>>       someaction()
>>
>> end
>> Can we achieve this in Guvnor??
>> please help....
>>
>> Thanks
>> Deepak Prabhakar Jambhekar
>>
>> =====-----=====-----=====
>> 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
>>
>>
>
> _______________________________________________
> 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/20091204/81a902f7/attachment.html 


More information about the rules-users mailing list