[rules-users] string comparison

Wolfgang Laun wolfgang.laun at gmail.com
Wed Oct 27 02:24:44 EDT 2010


This is from the original post:

rule "14bisbis"
        salience 19
        when
                p : Patient(p.getFumeurPetit().equals("vrai"))
        then
                //p.setHabitudesMoyennes("true");
                System.out.println("14-bisbis applied:
fumeurpetit->true => "+p.getFumeurPetit());
end

To write a constraint against the Patient field furneurPetit you
write, within a "Patient" pattern,
the field name, a comparison operator and a literal, a variable or a
parenthesized expression.

Thus, in your case,
   p : Patient( fumeurPetit == "vrai" )

The proposed solution is not wrong, but less efficient and not as readable.

-W



On 27 October 2010 06:40, Ji Oh Yoo <jioh.yoo.dev at gmail.com> wrote:
>
> I'm not 100% sure, (I'm a newbie!)
>
> but please try
>    p : Patient()
>    eval( p.getFumeurPetit().equals("vrai") )
>
>
> Ji Oh
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/string-comparison-tp1768776p1778234.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list