Module for EDI 9.12 | Building Services with EDI Module | Part I WmEDI Package | WmEDI TRADACOMS Folder | Summary of Elements in this Folder | wm.b2b.edi.tradacoms:convertToString
 
wm.b2b.edi.tradacoms:convertToString
WmEDI. Converts an IS document (IData object) to a String based on a flat file schema that you specify.
The difference between this service and the pub.flatFile:convertToString service is that this service handles TRADACOMS EDI files.
The service will optionally fill in the counters and control numbers if they are empty. If you want to control the counters or control numbers, modify the IS document (IData object) prior to invoking this service to convert it to a String.
In addition, the service will automatically provide values for the following fields if they are not present:
Segment
Field
Value provided
END
NMST
The number of messages or batches in the transmission.
EOB
NMST
The number of MHD segments in the batch.
MHD
MSRF (for each MHD segment)
A consecutive count of MHD segments in the transmission or batch, starting from 1 and incrementing by 1 for each MHD.
MTR
NOSG
The number of segments from the last MHD to this MTR segment, including both the MHD and MTR segments.
Input Parameters
values
Document The IS document (IData object) object that you want to convert to a String.
TradacomsFFSchema
String The fully-qualified namespace name of the flat file schema to use to convert the specified IS document (IData object) (in values) to a String.
spacePad
String (optional) How you want the resulting String to be justified. Specify one of the following:
Value
Meaning
left
Left justify.
right
Right justify.
none
No justification. This is the default.
noEmptyTrailingFields
String (optional) Whether to remove empty trailing fields from records. The convertToString service only uses this parameter for records that have delimited fields. Specify true or false.
Value
Meaning
true
The convertToString service removes empty trailing fields from the output. For example, a record with empty trailing fields might look like the following: AAA*01*02! (where ! is the segment terminator). This is the default.
false
The convertToString service does not remove empty trailing fields. Instead it uses the field separator to denote an empty field. For example, a record with empty trailing field might look like the following: AAA*01*02********!(where * is the field separator and ! is the segment terminator).
FormatInfo
Document (optional) Values you want the convertToString service to pass unmodified to all format services it invokes.
outputFileName
String (optional) The name of the file to which you want the String output written. If you do not specify outputFileName the output is not written to a file.
encoding
String The type of encoding used to write data to the output file. The default encoding is UTF-8.
startAt
String (optional) Allows the convertToString service to start at a specific record in the flat file schema used to create the output string. Specify the path to the element where you want to start composing the output string.
countSegments
String (optional) Whether to count the number of segments written to the output file.
true
The convertToString service counts the number of segments written to the output file and returns that number in the output parameter segmentCount. This is the default.
false
The convertToString service does not count the number of segments written to the output file.
Output Parameters
string
String The output String that represents the data specified in the Values input parameter.
errorArray
String List Error messages describing the errors that the convertToString service encountered during conversion. If the convertToString service did not encounter errors, errorArray is null.
segmentCount
String The number of records written; only returned when countSegments is true.