Relaxing Field Validation Print this Topic Previous Page Up One Level Next page

Home >  Data Sources and Targets > EDI > Customizing EDI Validation >

Relaxing Field Validation

There are cases when a standard does not completely enforce the code values that a field may have, allowing code values defined by external standards or recommendations. Taking EDIFACT D16A as example, several fields allow code values defined in external ISO standards, or in UN/ECE recommendations. For example, Data Element 4405 defines 146 code values, but also allows use of external UN/ECE Recommendation 24, which specifies 346 code values.


In MapForce, the possible code values for a field are validated against a configuration file having the .codelist extension (hereafter referred to as the ".codelist" file). When MapForce processes an EDI file, it normally produces a validation error if a field does not have any of the code values specified in the .codelist file for that EDI flavour. (This assumes you have not changed the default validation options so as to silently ignore invalid field values, see EDI component validation.) The .codelist files available for each EDI flavour are in the C:\Program Files\Altova\MapForce2019\MapForceEDI\ directory. For example, the UNCL.codelist file available in C:\Program Files\Altova\MapForce2019\MapForceEDI\EDIFACT\ stores possible code values for fields in UN/EDIFACT fields.


The default .codelist file includes all possible code values for a field, according to the respective EDI standard. When code values are not explicitly defined by the standard but enforced by external standards, validation is considered to be incomplete. Namely, when the EDI standard does not fully enforce the list of code values for a particular field (such as Data Element 4405 of UN/EDIFACT D16A), processing the field during the mapping execution would normally raise validation errors. Specifically, MapForce (or the execution engine running the EDI mapping, be it MapForce Server, or a C#, C++, or Java program) reports an error in the format: {Value} is not a legal value for field {Field}. This error means that the field value was not found in the list of existing code list values defined in the .codelist file.


To prevent the mapping process from being stopped when errors such as above are encountered, you can do the following:


1.Change the validation behavior from EDI Validation Settings (for example, select the check box Report & Accept next to "Invalid code list value" on the EDI Validation Settings dialog box. (To configure EDI validation settings, click the Validation button on the EDI Component Settings dialog box.)


2.Relax field validation from configuration files, as shown below.


MapForce provides a mechanism by which a field can be marked as having "incomplete" validation rules. This ensures that MapForce (or the execution engine running the EDI mapping, be it MapForce Server, or a C#, C++, or Java program) does not produce an error message when the field is processed; instead, a warning is displayed, and the mapping process resumes. In other words, "incomplete" validation means that only the code values defined in the MapForce default .codelist file should be considered for validation, not those defined externally.


To allow for flexibility without adding too much complexity, the default .codelist configuration files supplied with MapForce treat certain fields as having incomplete validation.


By default, MapForce produces warnings (not errors) if any of the following fields contain code values that are defined in external specifications:


Data Element 4053 of UN/EDIFACT D.16A
Data Element 4277 of UN/EDIFACT D.16A
Data Element 4405 of UN/EDIFACT D.16A
Data Element 8179 of UN/EDIFACT D.16A


The warning is produced so as to make you aware that validation of this field is incomplete. Incomplete validation may result in incorrect data being produced by the mapping. To prevent this from happening, it is recommended to perform full field validation, by means of custom .codelist files to MapForce. Custom .codelist files let you define external code values in a format understood by MapForce and perform full validation of the field. For more information, see Adapting Code Values from External Sources.


Note:Data Element 8155 also relies for validation on an external standard (the ISO 6346 standard); however, for this field MapForce provides full validation by means of a separate .codelist file, see Adapting Code Values from External Sources).


If necessary, you can additionally customize other fields to be treated as having incomplete validation rules. To instruct MapForce that a field has incomplete validation rules, do the following:


1.Locate the .codelist file in the C:\Program Files\Altova\MapForce2019\MapForceEDI\ directory (subdirectories exist for each EDI flavour), and open it with an XML editor such as XMLSpy.
2.Find the <Field> element corresponding to the required data element, and add the attribute Incomplete="1" to it (highlighted below), for example:


<Field Name="F8179" Length="8" Type="Alphanumeric" Incomplete="1">
  <Title>Transport means description code</Title>
  <Description>Code specifying the means of transport.</Description>
  <Note>1 Use UN/ECE recommendation 28.
    <Value Code="1">
        <Title>Box tricycle</Title>
        <Description>Tricycle with a basket for delivering goods.</Description>


Note:You must have write permissions to the C:\Program Files\Altova\MapForce2019\MapForceEDI directory in order to modify its contents.


If your processing requirements demand that an error should be raised instead of a warning for any fields that were already marked as "incomplete", change the attribute Incomplete to value "0" instead of "1". This way, field validation will be enforced strictly, and errors (not warnings) will occur if the field value is not part of the set of values defined in the .codelist file.

© 2019 Altova GmbH