0 Replies Latest reply on Sep 5, 2012 5:54 AM by shekh

    Compare list item properties in drools when condition

    shekh

      Dear all,

       

      I have inserted list of elements in StatefulKnowledgeSession. Now in When clause in drools .drl file I need to compare some propertiy values of different elements of the list.

       

      For example, I have a list of pets [ added in session as kbSession.insert(list) ]  where each pet has a name property (pet1.name = "adi", pet2.name="flix"). So what would be best for checking this items in when clause?

       

      Say in my test.drl file I have

       

      rule "pet items"

      dialect "java"

       

      when

           list.get(0).name != list.get(1).name

       

      then

           do something!

       

       

      Any suggesstion is greatly appreciated!

       

       

      Kind Regards,

      Shekh