I can reproduce the error and I'll create a JIRA.
There are several things I can suggest as a workaround.
(1) Try using global Double for the temperature limits.
(2) Better: Use a single Parameter fact with double fields for
temperatureElevee and temperatureCritique:
rule "1- aTraiterUrgent"
when
Parameter( $te: temperatureElevee )
$patient : PatientDto( eval(
$patient.getDoubleValue("temperature") > $te ) )
(2++) You might also provide a getter double getTemperature for PatientDto.
rule "1- aTraiterUrgent"
when
Parameter( $te: temperatureElevee)
$patient : PatientDto( termperature > $te )
-W
On 11 February 2011 09:21, Nico ROEDERER <ino.nicolas(a)gmail.com> wrote:
Yeah, temperatureCritique is greater than temperatureElevee
Here's my PatientDto constructor :
("temperature" is one of the "caracteristique" of the HashMap...)
public PatientDto( long pNum, String pNom, HashMap<String, String> pMap ) {
setNumPatient( pNum );
setNomPatient( pNom );
setCaracteristique( pMap );
}
In a properties file :
valeur.verifTemperature.elevee = 37
valeur.verifTemperature.critique = 40
In my 'RunRules.java' :
vSession.setGlobal( "temperatureElevee", Integer.parseInt(
vProp.getProperty( "valeur.verifTemperature.elevee" ) )
);
vSession.setGlobal( "temperatureCritique", Integer.parseInt(
vProp.getProperty( "valeur.verifTemperature.critique" ) )
);
( vProp.getProperty( "valeur.verifTemperature.elevee" ) return 37 and
vProp.getProperty( "valeur.verifTemperature.critique" ) return 40)
I don't know what's wrong....
Thanks for the help.
Le 10/02/2011 19:38, Wolfgang Laun a écrit :
How, exactly, do you set the globals and how do you create the PatientDTO
fact?
If the temperature is higher than temperatureCritique >=
temperatureElevee, both rules will fire.
-W
On 10 February 2011 16:00, ino.nicolas <ino.nicolas(a)gmail.com> wrote:
>
> Hi. I've got a trouble in a drl file.
> Here's my file :
>
> #created on: 9 févr. 2011
> package regles
>
> # import
> import com.compagny.rules.metier.dto.PatientDto;
>
> # global variables
> global Integer surPoids;
> global Integer diffTaille;
> global Integer temperatureElevee;
> global Integer temperatureCritique;
> global Integer tropGrand;
>
> rule "1- aTraiterUrgent"
> when
> $patient : PatientDto()
> eval( $patient.getDoubleValue("temperature") >
> temperatureCritique )
> then
> $patient.addCommentaire( " Le patient " +
> $patient.getNomPatient() + " est
> à traiter d'URGENCE. " );
> end
>
> rule "2- estFievreux"
> when
> $patient : PatientDto()
> eval( $patient.getDoubleValue("temperature") >
> temperatureElevee.doubleValue() )
> then
> $patient.addCommentaire(
> $patient.getDoubleValue("temperature") +
> " - Le patient " + $patient.getNomPatient() + "
est
> fievreux. " );
> end
>
>
> The both rules are nearly the same. Except the comparator (
> temperatureCritique and temperatureElevee).
> My problem :
> - If I put the '.doubleValue()' to the both rule, the second rule will
> never
> be launched.
> - If I don't put the '.doubleValue()' in the first and the second rule,
> the
> second rule will never be launched.
> - If I put the '.doubleValue()' in one of the two rules (never mind if
> it's
> in the first or second one), both of the rules are launched.
>
> I don't know what I did wrong...
> Could you please help me ?
>
> --
> View this message in context:
>
http://drools-java-rules-engine.46999.n3.nabble.com/Conversion-Error-in-D...
> 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
>
_______________________________________________
rules-dev mailing
listrules-dev@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-dev
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev