[rules-users] nested condition in from collect

lnguyen mzspdrcr at gmail.com
Tue Oct 5 13:43:08 EDT 2010


I'm trying to determine if a user has a certain immunization on record or a
group of immunizations but when I attempt to put additional the rule will
not compile.

rule "Immunizations_Determine if a user has a valid tetanus immunization"
dialect 'mvel'
    no-loop true
    salience 100
when
      $user : User($profile : profile)
      $got : List() from collect ( UserImmunization( immunization != null,
eval( immunization.immunizationName == "Td or Tet/Dip (Tetanus/Diphtheria)"
|| immunization.immunizationName == "Tdap (Tetanus/Diphtheria & Pertussis)"
|| immunization.immunizationName == "DT (Diphtheria/Tetanus)" ||
immunization.immunizationName == "TT or Tet Tox (Tetanus Toxoid)" ||
immunization.immunizationName == "Tetanus")) from $profile.userImmunizations
)
then
      System.out.println("The user has has a valid tetanus immunization ");
end

The profile contains a list of UserImmunizations.

UserImmunizations:

    private Long id;
    private Immunization immunization;
    private Date dateReceived;

Immunizations:

    private Long id;
    private String immunizationName;

I'm not sure if this is a good place to use 'from accumulate'.

Is it possible to do the condition for the Immunization object within the
'from collect' or should it be evaluated separately?
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/nested-condition-in-from-collect-tp1637479p1637479.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list