[rules-users] Update property

tommmyknocker thomas.moncieu at gmail.com
Wed Sep 3 10:46:17 EDT 2008


I have a basic problem that I don't understand, it's obviously an error from
me.
I use drools 4.0.7.

My application creates bills and makes reduces on it.
I use a ruleflow that executes rules named "REMISE_IMMEDIATE" first and
"REMISE_TICKET" after.

Example of 2 rules :

rule "ID_150_TEST" 
ruleflow-group "REMISE_IMMEDIATE"
when 
r : Regle (numRegle == "1");
a : Article (regles  contains r);
t : TicketCaisse(  );
l : LigneTicket($n : numeroLigne, $q : quantiteTotal,ticket == t &&
quantiteTotal > 0 && article==a && remiseChoisie == true);
then 
System.out.println("test 1 : " + t.getTotalTicket());
t.setTotalTicket( 80 );
end

rule "ID_150_TEST_C" 
ruleflow-group "REMISE_DIFFEREE"
when 
t : TicketCaisse(totalTicket >= (new Double(100.0)) && totalTicket <= (new
Double(200.0)));
then 
System.out.println("test 2 : " + t.getTotalTicket());
IAvantageTicket newAvtgTicket = t.addAvantageTicket("BAT", 2, 20.0,
t.getNumeroMagasin());
end


Here is my case :

A bill (ticket in french) has an amount of 100.
A reduction should set this amount at 80 with the first rule
An advantage shouldn't be given on the Object Ticket because of the
condition totalTicket >= (new Double(100.0)) && totalTicket <= (new
Double(200.0))

Result :
The second rule give the advantage on the Object Ticket and the
System.out.println"test 2 : " + t.getTotalTicket()); give 80 !!!

I run my JUNIT test with the Debug mode in Eclipse and the object
TicketCaisse in the working memory has an amount of 80.

So I don't understand why the second rule has been executed...

I try to do
update(t);
in the first rule but it doesn't work.

Has someone any idea ?

I join the pojo TicketCaisse.
http://www.nabble.com/file/p19290828/TicketCaisse.java TicketCaisse.java 


-- 
View this message in context: http://www.nabble.com/Update-property-tp19290828p19290828.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list