let me clear this by following code


public static void main(String[] args){  

KnowledgeBase knowledgeBase = createKnowledgeBase();  
                ArrayList<SalesAmount> testSalesAmounts= getSalesAmount();
StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();   

for(SalesAmount eachSalesAmount: testSalesAmounts){
session.insert(eachSalesAmount);
session.fireAllRules();
   }

}

 
public static ArrayList<SalesAmount> getTestSalesAmounts(){
ArrayList<SalesAmount> testSalesAmount = new ArrayList<SalesAmount>();

for(int i =0; i<15;i++){
Random random = new Random();
SalesAmount.testSalesAmount= new SalesAmount();
testSalesAmount.setId(i);
                        testSalesAmount.setSalesAmount(random.nextInt(500));
                        
                        testSalesAmounts.add(testSalesAmount);
}
              return  testSalesAmounts;
         }



SalesAmounts is assigned  randomly using util class

and each fact is inserted  at a time in the loop control

if after the loop , the data changes how can i fire the rules

please modify my code if any mistakes you find........


regards
sai

On Fri, Oct 12, 2012 at 2:05 PM, abhinay_agarwal <abhinay_agarwal@infosys.com> wrote:
Hey sai,

First of all make sure whether you will be having a list of "objects"
containing "salesAmount" or list of "salesAmount".

If you are having a list, then your list should also be present in the WHEN
condition, such that when the state of your list changes then the rule gets
fired !!

Regards,
Abhinay



--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-firing-rules-twice-in-single-session-on-single-object-tp4020220p4020241.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users