<div>let me clear this by following code</div><div><br></div><div><br></div><div>public static void main(String[] args){  </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>KnowledgeBase knowledgeBase = createKnowledgeBase();  </div>
<div>                ArrayList&lt;SalesAmount&gt; testSalesAmounts= getSalesAmount();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();   </div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>for(SalesAmount eachSalesAmount: testSalesAmounts){</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> session.insert(eachSalesAmount);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span> session.fireAllRules();</div><div> <span class="Apple-tab-span" style="white-space:pre">                </span>  }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public static ArrayList&lt;SalesAmount&gt; getTestSalesAmounts(){</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>ArrayList&lt;SalesAmount&gt; testSalesAmount = new ArrayList&lt;SalesAmount&gt;();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>for(int i =0; i&lt;15;i++){</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>Random random = new Random();</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>SalesAmount.testSalesAmount= new SalesAmount();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>testSalesAmount.setId(i);</div><div>                        testSalesAmount.setSalesAmount(random.nextInt(500));</div>
<div>                        </div><div>                        testSalesAmounts.add(testSalesAmount);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div>              return  testSalesAmounts;</div>
<div>         }</div><div><br></div><div><br></div><div><br></div><div>SalesAmounts is assigned  randomly using util class</div><div><br></div><div>and each fact is inserted  at a time in the loop control</div><div><br></div>
<div>if after the loop , the data changes how can i fire the rules</div><div><br></div><div>please modify my code if any mistakes you find........</div><div><br></div><div><br></div>regards<div>sai<br><div><br><div class="gmail_quote">
On Fri, Oct 12, 2012 at 2:05 PM, abhinay_agarwal <span dir="ltr">&lt;<a href="mailto:abhinay_agarwal@infosys.com" target="_blank">abhinay_agarwal@infosys.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey sai,<br>
<br>
First of all make sure whether you will be having a list of &quot;objects&quot;<br>
containing &quot;salesAmount&quot; or list of &quot;salesAmount&quot;.<br>
<br>
If you are having a list, then your list should also be present in the WHEN<br>
condition, such that when the state of your list changes then the rule gets<br>
<div class="im">fired !!<br>
<br>
Regards,<br>
Abhinay<br>
<br>
<br>
<br>
--<br>
</div>View this message in context: <a href="http://drools.46999.n3.nabble.com/rules-users-firing-rules-twice-in-single-session-on-single-object-tp4020220p4020241.html" target="_blank">http://drools.46999.n3.nabble.com/rules-users-firing-rules-twice-in-single-session-on-single-object-tp4020220p4020241.html</a><br>

<div class="HOEnZb"><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br> <br><br><br>
</div></div>