<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hello,<br><br>If I have a complex rule with a few conditions concatenated via AND and OR and NOT, and the rule evaluated to true during the engine run - is there a way to figure out which of the conditions caused the rule to evaluate to true?<br><br>In a simple example:<br>rule "test1"<br> dialect "java"<br> when<br> $data : ContractRulesData (region=='NE' && sum > 250)<br> then<br> approverList.add("approver1, approver2, Level1");<br> System.out.println("test1 is TRUE; result: approver1, approver2, Level1");<br>end<br><br>I tried to add
an AgendaListener with the following code to find out which rules have fired:<br> public void afterActivationFired(AfterActivationFiredEvent event, WorkingMemory workingMemory) {<br> Activation activation = event.getActivation();<br> Rule rule = activation.getRule();<br> GroupElement[] leftElements = rule.getTransformedLhs();<br> System.out.println("afterActivationFired: rule = " + rule.getName());<br> System.out.println("Conditions: ");<br> for (GroupElement left_el: leftElements){<br> System.out.println(left_el.toString());<br> }<br><br>The output is somewhat cryptic :<br>afterActivationFired: rule = test1<br>Conditions:
<br>AND[Pattern type='[ClassObjectType class=com.emptoris.ecm.domain.ContractRulesData]', index='0', offset='0', identifer='[Declaration: type=ValueType = 'Object' identifier=$data]']<br><br>So, is there a way to get even more information about the conditions and whether they evaluated to TRUE or FALSE?<br><br><br>Thanks,<br>Marina<br><br></div></div></body></html>