This rule checks the length of the value of the specified field against the length defined in object.xml. You can check for lengths greater than or equal to the defined length or less than the defined length. This rule returns “true” if the length matches the specified length range; otherwise it returns “false”. The syntax for dataLength is:
<dataLength fieldName="name" len="length" more="true/false"/> |
The parameters for dataLength are:
fieldName – The qualified field name or assigned variable for the field to check.
len – The length to use to validate the field value.
more – An indicator of whether to check for lengths greater than or equal to the given length or for lengths less than the given length. Specify “true” to check for lengths greater than or equal to the given length, or specify “false” to check for lengths less than the given length.
The following sample checks postal code fields to verify they do not exceed the United States length of five characters. If a postal code containing more than five characters is found, the record is rejected an written to the bad data file. If a postal code contains five or fewer characters, the field is returned as good.
<rule> <if> <condition> <dataLength fieldName="Person.Address.PostalCode" len="6" more="true"/> </condition> <then> <reject fieldName="Person.Address.PostalCode"/> </then> <else> <return fieldName="Person.Address.PostalCode"/> </else> </if> </rule> |