Please do not use this list for simple questions - it is reserved for
discussion Drools development itself.
(1) The "exists(Account)" is superfluous; existence is implied by the match
in the next Conditional Element.
(2) The rule should match once and only once for each Account fact inserted
into Working Memory.
Reading the Drools Expert documentation might clarify this and more for you.
-W
On 1 March 2011 09:53, pchenna <prashanth.sc(a)gmail.com> wrote:
I have a rule while calls doMenu to display options and modify data
accordingly.But why this rule is getting called only once even thought
"WHEN" condition is matching.Isn't it should be called every-time
condition
matches?
rule "Check trans"
dialect "java"
when
exists(Account())
$account :Account()
then
doMenu($account,drools.getWorkingMemory());
end
rule "Credit"
#some code here
end rule
rule "Debit"
#some code here
end rule
function void doMenu(Account account,WorkingMemory wm) {
String option = "1";
//while(!option.equalsIgnoreCase("3")){
option = JOptionPane.showInputDialog("1.Debit \n" +
"2.Credit \n" +
"3. Exit");
if(option.equalsIgnoreCase("1")){
String amount = JOptionPane.showInputDialog("Enter Amount
to be
Debited");
double amt = Double.parseDouble(amount);
Transaction t = new Transaction ( account, amt,
Transaction.DEBIT);
wm.insert(t);
}else if(option.equalsIgnoreCase("2")){
String amount = JOptionPane.showInputDialog("Enter Amount
to be
Credited");
double amt = Double.parseDouble(amount);
Transaction t = new Transaction ( account, amt,
Transaction.CREDIT);
wm.insert(t);
}
//}
}
Sorry if this question is very naive,tried searching in forums and couldn't
find anything helpful.
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Activating-the-rule-t...
Sent from the Drools - Dev mailing list archive at
Nabble.com.
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev