[rules-dev] eval problem

Nico ROEDERER ino.nicolas at gmail.com
Tue Mar 1 03:17:29 EST 2011


Hi,

I've got an other problem with an eval function.
I will try to discribe the path to the error.

I've got a repository where some people can put rules with .drl extension.
My program is listing this repository and execute every rule in this 
repository.

At the begining, I've got a 'PatientDto' who have a property :
int nbFactRisque;
(with getters and setters)

Some rules increments this number.

In the last rule (the rules are executed in alphabetic mode) I'm testing 
this number like this :

rule "RisqueNormal"
     when
         $patient : PatientDto()
         eval( $patient.getNbFactRisque() == 0)
     then
         $patient.addDonnees( Constants.CLE_RISQUEPATIENT, 
Constants.RISQUE_NORMAL );
         System.out.println("RisqueNormal vérifié." + 
$patient.getNbFactRisque() + "Facteurs.");
end

Here's my problem :
The 'Then' traitement is always executed so the eval always think that 
$patient.getNbFactRisque() is equal to 0.
But the system.out.println() show me that $patient.getNbFactRisque()  = 2 !

Here's the output : "RisqueNormal vérifié.2Facteurs.".

Perhaps I did something wrong ? Can someone help me ?
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110301/86d4121b/attachment.html 


More information about the rules-dev mailing list