[rules-users] If one exists check all

Brian Enderle brianke at gmail.com
Wed Sep 19 23:23:02 EDT 2007


I have a test case that says that if any one field is present then all must be 
present and then verified.  The items in question are for an Insurance object 
and are Name, Street, City, County, State, Country and Zip.  If one of the 
these 7 fields is present (not null/blank) then it and all the other fields 
need to be verified.  This needs to be done on a per object basis as not all 
InsuranceCarrier objects will have these fields filled in.

Just to clarify I need rules for each field similar to the following:

rule "Name cannot be blank"
   when
      $i : Insurance( name == null, street != null || city != null || 
                      county != null || state != null || country != null || 
                      zip != null)
   then
      <Report error>
end

Ithere a simple way to check all the values and then execute all the rules for 
that object?  

THanks in advance,
Brian Enderle




More information about the rules-users mailing list