This rule validates the specified fields against the length defined for those fields in object.xml. You can specify whether to reject records that exceed the defined length or to truncate the field value to the defined length. The syntax for validateDBField is:
<validateDBField> <field fieldName="name" action="reject/truncate"/> <field fieldName="name" action="reject/truncate"/> ... </validateDBField> |
The parameters for validateDBField are a list of fields and the action to take for each field. The field elements take the following parameters:
fieldName – The qualified field name or assigned variable for the field to validate.
action – The action to take if the field value exceeds the allowed length. Specify “reject” to reject the record as bad data, or specify “truncate” to truncate the field value to the length defined in object.xml.
The following sample checks the length of the social security number and last name in each record. If the social security number is too long, the record is rejected and written to the bad data file. If the last name is too long, it is truncated.
<rule> <validateDBField> <field fieldName="Person.SSN" action="reject"/> <field fieldName="Person.LastName" action="truncate"/> </validateDBFields> </rule> |