Hi,

in the beginning I inserted a couple of not processed customers in my workingmemory (#total = #not processed, #processed = 0). During the rules 1-9 a part ot these customers will be processed (call $customer.setProcessed(true) and udpate($customer) the wm).

Rule 10 + 11 should sort the customers. The result of rule 10 looks perfect, the list just contain the processes customers. The result of rule 11 looks bad, all customers in the wm are in the result. (#total = #not processed + #processed)

Rule 11 is activated as last one, in the insert process all customers are not processed, then I try to change the customer objects in the working memory (rule 1-9). The output produced in the for-loop shows that already processed customers are in the list, which should only contain not processed customers.

What is wrong, where I made my mistake?

best wishes+Thanks a lot.
Thorsten Trägenap

rule "#10"
   salience 46
   when
       $kunden : ArrayList() from collect (Customer(processed == true))
   then
System.err.println("customers already processed " + $kunden.size() + " " + $kunden);
end


rule "#11"
   salience 47
   when
       $cust : ArrayList() from collect (Customer(processed == false))
   then
System.err.println("Customer to process " + $cust.size() + " " + $cust);
       for (int i = 0; i < $cust.size(); i++) {
           Customer c = (Customer)$cust.get(i);
if (c.getProcessed()) System.err.println("Why i am here: " + c);
       }
end


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to