[rules-users] Finding matching values in composite constraint

Jeremy Ary jeremy.ary at gmail.com
Sat Jan 5 12:28:35 EST 2013


I'm unaware of any mechanism that will allow you to identify what portions
of the rete node triggered the activation directly as you've described.
Ultimately, they resolve to booleans and having multiple conditions would
further complicate your situation. However, I suspect that there's another
approach to solving the issue at hand. Can you better describe the problem
you're needing to solve that you'd want access to that information within
the consequence?

- jary


On Sat, Jan 5, 2013 at 11:17 AM, bdolbeare <bdolbeare at yahoo.com> wrote:

> Is there a way to determine (in the rule consequence) which condition in a
> composite constraint caused a rule to succeed?
>
> I am working on a system that allows users to create rules via a custom UI
> and when one of their rules fires, I want to be able to create a message
> that describes why their rule fired.  In a real example, they might have a
> list of a few hundred conditions in a composite constraint.
>
> An example rule with just two conditions in a composite constraint follows:
>
> rule "test rule"
> when
> MyObject( (myfield  str[startsWith] "a" || myfield str[startsWith] "b") )
> then
> System.out.prinltn(kcontext.getRule().getName() + " fired because myfield
> started with ???");
> end
>
> Is this exposed somewhere in the variables like kcontext that are available
> to each rule in their consequence?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Finding-matching-values-in-composite-constraint-tp4021343.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> 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/20130105/76387227/attachment.html 


More information about the rules-users mailing list