Configuring Format Services to Convert Field Values
A format service formats the value of a field and optionally validates the field against restrictions defined in the format service. Module for EDI provides format services to convert field values into a different format as required by your system. For example, a format service can change the format of a date field from YYYYMMDD to MMDDYYYY or data from the EDI standard into a different format used by your internal application. You associate format services with specific fields in a flat file schema.
The following EDI format services run automatically when defined as the conversion service for a flat file input schema:
wm.b2b.edi:convertToValues (or
wm.b2b.edi.tradacoms:convertToValues) service. Converts an EDI transaction set document to an IS document (IData object), which contains the internal document format.
wm.b2b.edi:convertToString (or
wm.b2b.edi.tradacoms:convertToString) service. Converts an IS document (IData object), which contains the internal document format, to an EDI document.
Important:
If a field does not have a value (that is, a value is not returned in the IS document (IData object) for the convertToValues service or is not present in the input data for the convertToString service), the assigned format service does not execute.
For more information about the
convertToValues and
convertToString services, see
webMethods Module for EDI Built-In Services Reference . For more information about how to use these services when processing EDI documents, see
Logic to Include in the Service to Process
EDI Documents.
The format services use the settings in the following configuration file to determine how to perform field conversions:
Integration Server_directory \instances\$instance_name\packages\WmEDI\config\format.xml
The format.xml configuration file specifies the format required by the EDI standard (external format) and your internal application (internal format). By default, the external formats in this configuration file match the EDI ANSI standard format. You must update the configuration so that it reflects the EDI standard that you are using and the formats of your internal application in order for the system to accurately convert field values from one format to another.
To apply conversion configurations, perform the following procedure to update the configuration in memory so changes are applied immediately, as well as in the format.xml file.
To configure field conversion values in documents
1. In My webMethods: Administration > Integration > B2B Settings > Configure Properties.
2. In the Module for EDI Format Settings panel, update each entry in the format.xml configuration file to meet your site's needs. Do not add any additional FormatService entries.
Each entry has the following format:
<FormatService
name="name_of_format_service"
isEnabled="true_or_false"
internalFormatString="format"
externalFormatString="format"
applyFormat="true_or_false"/>
For example:
<FormatService
name="formatDate6"
isEnabled="true"
internalFormatString="MM/dd/yy"
externalFormatString="yyMMdd"
applyFormat="true"/>
The following tables describes the meaning of each setting in an entry:
Setting | Description |
name | The name of the format service that the entry governs. Do not change name. The entry formatImpliedDecimal affects all implied decimal services (formatN0-formatN9), which format fields with EDI data types N0 - N9. For a complete description of these and other EDI format services, see webMethods Module for EDI Built-In Services Reference . |
isEnabled | Indicates whether the format service is enabled. Specify either true or false. true—The format service performs its processing to convert and/or validate field values. false—The format service immediately returns without performing any conversion or validation. Note: You can also configure whether to enable format services in the configuration of the WmFlatFile. Note: If the configuration for the WmFlatFile package specifies not to use format services, the convertToValues and convertToString services will not invoke the format service, even if the isEnabled configuration setting is set to true. For more information about how to configure the WmFlatFile package, see Flat File Schema Developer’s Guide. |
internalFormatString | The format required by your internal application (for example, your back-end system). Specify a string that follows the conventions described in the java classes java.text.DecimalFormat and java.text.SimpleDateFormat. For more information about these classes, see Oracle’s documentation. |
externalFormatString | The format required by the EDI standard you are using. If you are using the EDI ANSI standard format, you should not change this setting. Specify a string that follows the conventions described in the java classes java.text.DecimalFormat and java.text.SimpleDateFormat. For more information about these classes, see Oracle’s documentation. |
applyFormat | Whether the convertToValues or convertToString services should apply the converted value. true—The service validates and updates the document to reflect the converted value. false—The service validates, but does not update the document with the converted value. |
3. Click Save Changes.
For information about format services and the WmFlatFile package, including error information and how to specify format services for fields in flat file schemas and dictionaries, see the section on format services in the chapter on creating and editing flat file schemas and dictionaries in Flat File Schema Developer’s Guide.