[rules-users] Drools conddition fails if I use HashMap to check objects

Avin abhijeet.b.patil at jpmorgan.com
Wed Jan 8 10:14:55 EST 2014


Hi,
I have a rule written which compare objects with objects present in HashMap
and if object is found then clause gets executed.
I am able to wite the conditions for comparing with HashMap but if I add any
assign any value from the fact object  before comparison then my conditions
fail to evaluate and my then clause runs for all the objects 
Below is the code 
 rule "rule 1"  
 when
   //$factData: ConcentrationDataTable()	this line makes rule fail
  TempStorage($mapObject : concPercentRefObjects)   
  ConcentrationDataTable($concPercentage : concPercentage)
  $referenceData : ConcentrationDataTable($keyObject : concPercentRefkey)  	  
  eval( $mapObject.get($keyObject) != null	)  
  and 
  eval($concPercentage >
(((ConcPercentRef)$mapObject.get($keyObject)).getPercent()))
  
 then  
  System.out.println("Rule 222  executed "+ " condition "+$factData  + "   
reference value "+$mapObject.get($keyObject) );  
  //filteredDataList.add($factData); I require this object(fact object) to
be stored in list for further process
 end
*Results *
Rule 222  executed  condition 1424975     1424975    key value value 1424975  
Rule 222  executed  condition 14249751     14249751    key value 1424975 --
failed result should not have got printed 






--
View this message in context: http://drools.46999.n3.nabble.com/Drools-conddition-fails-if-I-use-HashMap-to-check-objects-tp4027603.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list