Altova MapForce 2025 Enterprise Edition

Character-Level Validation

Home Prev Top Next

MapForce enables you to define advanced validation rules for fields that require validation not only at field level, but also at character level. An example of a field that requires such validation is Data Element 8155 (UN/EDIFACT). This field accepts not only code values defined in UN/EDIFACT, but also external codes specified in ISO 6346. Note that ISO 6346 is mentioned here only as an example. The MapForce configuration files already include validation rules for ISO 6346.

 

When you need to validate a field at character level, add the code values globally, as shown in Full Field Validation.

 

ISO 6346

ISO 6346 is an international standard that provides information on freight containers. ISO 6346 uses special size and type codes that consist of the following characters:

 

The first character indicates the length of a container.

The second character indicates the height and width of a container.

The third and fourth characters describe the type of a container.

 

An example of a size and type code is 20G0 that stands for a general-purpose container.

 

ISO6346.Codelist

You can configure MapForce in such a way that it validates Data Element 8155 not only in accordance with the UN/EDIFACT code values, but also with ISO 6346. The code listing below shows an extract from ISO6346.Codelist that is located in the MapForceEDI\EDIFACT directory of your application folder. In the code listing below, each <Field> element has a set of code values that correspond to the acceptable values for each character from the list above (e.g., G0 in the third Field element).

 

<?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="F8155" Type="Alphanumeric" ListName="ISO6346" Length="1" Offset="1">
        <Title>ISO 6346</Title>
        <Description>Code specifying seagoing container type.</Description>
        <Values>
           <Value Code="1"/>

           <...>
           <Value Code="N"/>
        </Values>
     </Field>
     <Field Name="F8155" Type="Alphanumeric" ListName="ISO6346" Length="1" Offset="2">
        <Title>ISO 6346</Title>
        <Description>Code specifying seagoing container type.</Description>
        <Values>
           <Value Code="0"/>

           <...>
           <Value Code="F"/>
        </Values>
     </Field>
     <Field Name="F8155" Type="Alphanumeric" ListName="ISO6346" Length="2" Offset="3">
        <Title>ISO 6346</Title>
        <Description>Code specifying seagoing container type.</Description>
        <Values>
           <Value Code="G0"/>

           <...>
           <Value Code="A0"/>
        </Values>
     </Field>
  </Codelist>
</Config>

 

In the code listing above, each <Field> element has the following attributes:

 

The Name attribute refers to the name of the field (Field F8155 in our example).

The Type attribute specifies the data type of the data element (Alphanumeric in our case).

The ListName attribute has the name of a code list (in our example, ISO6346 for all the three sets of code values).

The Length attribute specifies the number of characters to be validated. Each value in the first and second sets is one character long, while each value in the third set is two characters long.

The Offset attribute specifies the position at which MapForce (or the external execution engine) must start reading the characters from the data field that is being validated. For example, in the size and type code 20G0, 2 has the offset value of 1, 0 has the offset value of 2, and G0 has the offset value of 3.

 

If the Length attribute is defined, the Offset attribute must be defined as well. The values of the Length and Offset attributes must be greater than zero.

 

Each Length-Offset combination together with the code values defined in <Values> represent a validation condition at character level. For field validation to be successful, all character-level conditions with the same ListName attribute value must be satisfied. If any of the conditions is not satisfied, the field value is not valid. A field may have more than one list of possible code values. To be considered valid, the field value must be present in at least one of the lists.

 

© 2018-2024 Altova GmbH