Please do not use this list for simple questions - it is reserved for discussion Drools development itself.<br><br>(1) The &quot;exists(Account)&quot; is superfluous; existence is implied by the match in the next Conditional Element.<br>
(2) The rule should match once and only once for each Account fact inserted into Working Memory.<br><br>Reading the Drools Expert documentation might clarify this and more for you.<br><br>-W<br><br><br><br><div class="gmail_quote">
On 1 March 2011 09:53, pchenna <span dir="ltr">&lt;<a href="http://prashanth.sc">prashanth.sc</a>@<a href="http://gmail.com">gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have a rule while calls doMenu to display options and modify data<br>
accordingly.But why this rule is getting called only once even thought<br>
&quot;WHEN&quot; condition is matching.Isn&#39;t it should be called every-time condition<br>
matches?<br>
<br>
rule &quot;Check trans&quot;<br>
        dialect &quot;java&quot;<br>
        when<br>
                exists(Account())<br>
            $account :Account()<br>
        then<br>
                doMenu($account,drools.getWorkingMemory());<br>
<br>
end<br>
<br>
rule &quot;Credit&quot;<br>
#some code here<br>
end rule<br>
<br>
rule &quot;Debit&quot;<br>
#some code here<br>
end rule<br>
<br>
<br>
function void doMenu(Account account,WorkingMemory wm) {<br>
<br>
        String option = &quot;1&quot;;<br>
        //while(!option.equalsIgnoreCase(&quot;3&quot;)){<br>
<br>
        option = JOptionPane.showInputDialog(&quot;1.Debit \n&quot; +<br>
                                                &quot;2.Credit \n&quot; +<br>
                                                &quot;3. Exit&quot;);<br>
<br>
        if(option.equalsIgnoreCase(&quot;1&quot;)){<br>
<br>
                String amount  = JOptionPane.showInputDialog(&quot;Enter Amount to be<br>
Debited&quot;);<br>
                double amt = Double.parseDouble(amount);<br>
                Transaction t = new Transaction ( account, amt, Transaction.DEBIT);<br>
                wm.insert(t);<br>
<br>
<br>
        }else if(option.equalsIgnoreCase(&quot;2&quot;)){<br>
<br>
                String amount  = JOptionPane.showInputDialog(&quot;Enter Amount to be<br>
Credited&quot;);<br>
                double amt = Double.parseDouble(amount);<br>
                Transaction t = new Transaction ( account, amt, Transaction.CREDIT);<br>
                wm.insert(t);<br>
        }<br>
<br>
//}<br>
}<br>
<br>
Sorry if this question is very naive,tried searching in forums and couldn&#39;t<br>
find anything helpful.<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Activating-the-rule-tp2601621p2601621.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Activating-the-rule-tp2601621p2601621.html</a><br>

Sent from the Drools - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
</font></blockquote></div><br>