[rules-users] Finding matching values in composite constraint

bdolbeare bdolbeare at yahoo.com
Sat Jan 5 12:17:32 EST 2013


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.


More information about the rules-users mailing list