Module for EDI 9.12 | Building Services with EDI Module | Part I WmEDI Package | WmEDI Core Services | Summary of Elements in this Folder | wm.b2b.edi:convertToValues
 
wm.b2b.edi:convertToValues
WmEDI. Converts an InputStream or String (for example, an EDI transaction set document) to an IS document (IData object) based on the input flat file schema.
Note:
To convert TRADACOMS documents, use the wm.b2b.edi.tradacoms:convertToValues service instead of this service.
Input Parameters
edidata
String or InputStream The data you want to convert to an IData object.
ediObject
Object (optional) An object that encapsulates and keeps track of the input data segments during processing. It is used only when the iterator parameter has been set to true.
encoding
String (optional) The encoding of the InputStream passed in to edidata. The default is UTF-8.
EDItemplate
Document (optional) This input parameter is provided only for backwards compatibility. It should contain a single name/value pair that is a String named templateName with the value set to the namespace name of the flat file schema to use for the conversion. This is the output from the wm.b2b.edi.templateMgr:getTemplate service. Do not specify an EDI template.
You must specify EDIffSchema or EDItemplate. The EDItemplate parameter is deprecated, so it is recommended that you use EDIffSchema.
EDIFFSchema
String The fully-qualified name of the flat file schema object used to parse the edidata object.
You must specify EDIffSchema or EDItemplate. The EDItemplate parameter is deprecated, so it is recommended that you use EDIffSchema.
delimiters
Document (optional) Delimiters to use to parse the input data. If no delimiters are specified, the convertToValues service uses the corresponding delimiter defined for the flat file schema.
Note:
If you specify a value for one parameter of delimiters, you must specify values for all the parameters. If you specify delimiters, the delimiters in the flat file schema will not be used.
Key
Description
record
String The segment terminator used in the input data.
field
String The field separator used in the input data.
subfield
String The subfield separator used in the input data.
release
String The release character used in the input data.
FormatInfo
Document Values you want the convertToString service to pass unmodified to all format services it invokes.
iterator
String (optional) Whether you want to process segments one at a time or process all input data at one time. Specify true or false.
Value
Meaning
true
The convertToValues service starts processing segment structures with a top-level record as defined by the flat file schema. The service returns to the caller when it encounters another top-level record in the input data. The next time the service is invoked, it begins processing the input data where it left off.
false
The convertToValues service processes all input data at one time. This is the default.
nullable
String (optional) Whether to create an IS document (IData object) if all fields are null. Specify true or false.
Value
Meaning
true
Do not create an IS document (IData object) if all the fields are null. This is the default.
false
Always create an IS document even though all the fields are null.
skipWhiteSpace
String (optional) Whether to ignore white space from the beginning of records. Specify true or false.
Value
Meaning
true
Ignore white spaces at the beginning of records. This is the default.
false
Use records as they are. Specify false when the data contains positional data records.
keepResults
String (optional) Whether you want the convertToValues service to return an IData object or to just validate the structure of the data in edidata. Specify true or false.
Value
Meaning
true
Return an IData object in the output parameter, EDIValues. This is the default.
false
Do not return an IData object in the EDIValues output parameter. Use this option when validating the structure of the edidata against the specified flat file schema.
validate
String (optional) Whether you want the convertToValues service to return error messages describing how edidata differs from the specified flat file schema. Specify true or false.
Value
Meaning
true
Return errors describing how the given edidata violates the constraints described in the flat file schema.
false
Do not return error messages describing how the edidata differs from the specified flat file schema. This is the default.
returnErrors
String (optional) How you want the convertToValues service to return error messages when validate is set to true. Specify one of the following.
Value
Meaning
asArray
Return validation errors with the edidata in an array called errors. This is the default.
inResults
Return validation errors in the EDIValues object.
both
Return validation errors in both errors and EDIValues.
maxErrors
String (optional) Maximum number of errors that you want returned when validate is set to true. When the flat file parser encounters more than the maximum number of errors within a record, the parser stops parsing and returns the parsed data and errors processed up until that point.
flag
Document (optional) Flags that you can set to govern convertToValues options.
Key
Description
addRecordCount
String Whether you want the service to add an additional field (@record-count) to each parsed record in the resulting IData object (EDIValues). The @record-count field is used to identify the record number of each parsed record.
Value
Meaning
true
The @record-count field is added to each parsed record. This field contains the number of the parsed record. The first parsed record is 1, the second is 2, etc.
If there are records that are undefined data, the count of the next defined record will reflect the undefined data. For example, if the @record-count field for a record is 2 and that record contains 5 undefined records, the @record-count field for the next defined record will be 8.
false
The @record-count field is not added to each parsed record. This is the default.
detailedErrors
String Whether you want detailed conditional validation error information. This flag is only used when validate is true.
Value
Meaning
true
When a conditional validation error occurs, the errors output parameter will contain detail information about all the conditions that were violated. For more information, see information about validation errors in the Flat File Schema Developer’s Guide.
false
When a conditional validation error occurs, the service does not provide detail error information. Conditional validators report only whether a condition failed validation with no additional information about the conditions that were violated. This is the default.
RepeatingField_separator
String (optional) The field separator that you want the convertToString service to insert between repeating fields of an EDI document.
Module for EDI recognizes both repeating simple fields and repeating composite fields.
Output Parameters
EDIValues
Document The edidata input data in IS document (IData object) format.
ediObject
Object (optional) An object that encapsulates and keeps track of the input data segments during processing. It is used only when the iterator parameter has been set to true. When all input data has been processed, the object becomes null. When the ediObject parameter is null, you should exit out of the LOOP to discontinue processing. For an example of processing a document segment by segment, see the "receiving and processing inbound documents" chapter of the webMethods Module for EDI Installation and User’s Guide.
isValid
String Whether the data in edidata is valid.
Value
Meaning
true
The validate input parameter was set to true and no errors were found.
false
The validate input parameter was set to true and errors were found, or the validate input parameter was set to false.
errors
Document List (optional) The validation errors, if any, that were found in edidata. Validation errors are returned in errors only if validate is set to true -AND- returnErrors is set to asArray or both. The list includes the path of the errors.
Usage Notes
*This service always returns the output IData object that contains the converted data in the EDIValues output parameter. When the input parameter iterator is set to true, the value of EDIValues is overwritten with the IData object for the record structure most recently converted. As a result, each time you invoke this service to convert a segment of the input document you should save the output or map it somewhere else.
Example
See the sampleServices:Iterator810 service WmEDIsamples package, which is located in the Technical Community area of the Empower Product Support website.