Full Field Validation (Global)
When incomplete validation of a field is not acceptable or desirable, it is possible to configure MapForce to perform full field validation. Using incomplete validation is a simpler solution. However, incomplete validation might lead to invalid data in the output. Therefore, full field validation is recommended instead. This approach requires using custom .codelist files in addition to the default ones that are already available in MapForce.
The role of custom .codelist files is to supply any code values that are not defined in the EDI standard and not present in MapForce configuration files. This usually applies to code values that are defined in external standards and recommendations. A custom .codelist file must include all code values defined in an external standard.
To perform the full field validation of fields whose code values are defined in an external standard, take the following steps:
1.Create a custom EDI collection. For more information, see Create a Custom EDI Collection. Although it is possible to define external code lists by editing the existing .codelist file supplied with MapForce, this is not recommended. You should always define external code lists in custom files and avoid any changes to the default MapForce configuration files.
2.In your custom EDI collection's directory, find the .codelist file that will be used as a template. For example, if you add a custom .codelist file to validate UN/EDIFACT messages, use the UNCL.Codelist file as a template.
3.Copy the .codelist file and give a new name to the copied file. This file will be referred to from other MapForce configuration files.
4.Open the file in an editor (e.g., Altova XMLSpy) and delete all the content of the <Codelist> element.
5.Add a new <Field> structure under <Codelist> (see below). In this example, we are adding external code values for Data Element 4405 of UN/EDIFACT. You can find the correct name, length and type of each field in the default .codelist file supplied with MapForce (in this example, UNCL.Codelist).
<?xml version="1.0" encoding="UTF-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="5" xsi:noNamespaceSchemaLocation="../EDIConfig5.xsd">
<Codelist>
<Field Name="F4405" Length="3" Type="Alphanumeric">
<Title>Trade and transport status codes</Title>
<Description>Code specifying a status.</Description>
<Values>
<...>
<Values>
</Field>
</Codelist>
</Config>
6.Under <Values>, add a new <Value> element for each external code, as shown in the code listing below. In this example, we are adding the first two codes defined in UN/ECE Recommendation 24.
<?xml version="1.0" encoding="UTF-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="5" xsi:noNamespaceSchemaLocation="../EDIConfig5.xsd">
<Codelist>
<Field Name="F4405" Length="3" Type="Alphanumeric">
<Title>Trade and transport status codes</Title>
<Description>Code specifying a status.</Description>
<Values>
<Value Code="1">
<Title>Arrival, completed</Title>
<Description>The goods/consignment/equipment/means of transport has arrived.</Description>
</Value>
<Value Code="2">
<Title>Loading, authorized</Title>
<Description>Authorization to load has been given.</Description>
</Value>
<Values>
</Field>
</Codelist>
</Config>
At this stage, the custom .codelist file is ready but not yet bound to MapForce. In order for MapForce to recognize the custom .codelist file, take the steps below:
1.Since Data Element 4405 no longer has incomplete validation, MapForce must be instructed to perform full validation: Remove the Incomplete="1" attribute for this field from the UNCL.codelist file or set the value of this attribute to 0. The second option is shown below:
<Field Name="F4405" Length="3" Type="Alphanumeric" Incomplete="0">
<Title>Status description code</Title>
<Description>Code specifying a status.</Description>
<Note>1 For transport status, use UN/ECE Recommendation 24.</Note>
<...>
</Field>
2.Reference the UNECE24.codelist file in the UNCL.codelist file as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="5" xsi:noNamespaceSchemaLocation="../EDIConfig5.xsd">
<Include href="UNECE24.codelist"/>
<Codelist>
<...>
</Codelist>
The same approach can be used for other EDI standards to perform full field validation based on an external standard.
Note that the instructions above cause the field validation to be global, for any segment that may be using Field 4405. In some cases, you may want the custom code lists to apply only to certain messages (i.e. locally). For more information about using the local approach, see Message-Level Validation.