[rules-users] named consequences for an or...

pmander paul.s.mander at gmail.com
Mon Jan 20 11:38:32 EST 2014


I was using or in a rule for example

rule "or example"
when
$t : (Transaction(org == "us") or Transaction(acc == "111"))
then
insert(new Record($t, 1));
end

This would work but would create 2 Record objects which we sorted out later
on but now for performance reasons I don't want the second match to be
evaluated if the first one matches. I saw a post about named consequences
and came up with something like:

when
 	$t : Transaction(org == "us")
 	if ($t != null) break[t1]
	$t1 : Transaction(acc == "111")
then
	insert(new Record($t1, 1));
then[t1]
	insert(new Record($t, 1));
end

This compiles but the "or" doesn't work. This is probably due to my "break".
Is there a way I can do what I need?

Note that the performance implication of performing the or is not apparent
in this example but it is there - I have simplified this example to make it
easier to talk about (and to protect the innocent)



--
View this message in context: http://drools.46999.n3.nabble.com/named-consequences-for-an-or-tp4027775.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list