FlatFile Module 10.7 | Flat File Built-in Services Referrence Guide | wmFlatFile Package | Flat File Folder | Summary of Elements in the Flat File Folder | pub.flatFile:convertToString
 
pub.flatFile:convertToString
WmFlatFile. Converts an IS document (IData object) to a flat file document based on the flat file schema that you specify.
By default, this service returns the document as a string, but you can set a flag to optionally return the document as a byte array instead.
Note:
This service does not validate the document.
Input Variables
ffValues
Document. The IData object representing the flat file.
ffSchema
String. Namespace name of the flat file schema to use to convert the given IS document to a string.
spacePad
String. Optional. How to position the records in the flat file.
Value
Description
left
Left justify the records (add blank spaces to the right of the records) before the records are written to the output. This is the default.
right
Right justify the records (add blank spaces to the left of the records) before the records are written to the output.
none
No spaces added.
signalError
String. Whether to create errors in the output.
Value
Description
false
Do not create errors in output.
true
Create errors in output.
If you are upgrading from webMethods Integration Server version 4.6, to enable left or right justification you must add the following line to the Integration Server_directory \instances\instance_name\packages\WmFlatFile\config\ff file:
spacePadJustifies=false
Then, reload the WmFlatFile package so that this configuration setting will take effect. For details, see the Flat File Schema Developer’s Guide or webMethods Service Development Help.

noEmptyTrailing Fields
String. Whether trailing empty fields are to be removed from the output. Used only with records that have delimited fields.
Value
Description
true
Trailing empty fields will be removed from the output. For example, if it is set to true, the output for a record with empty trailing fields looks like the following: AAA*01*02! (where ! is used as segment terminator). This is the default.
false
A field separator remains to denote an empty field. For example, if it is set to false, the output for a record with empty trailing fields looks like the following: AAA*01*02********! (where ! is used as segment terminator).

noEmptyTrailing SubFields
String. Whether trailing empty subfields are to be removed from the output. Used only with records that have delimited fields.
If no value is specified for the noEmptyTrailingSubFields parameter, Integration Server uses the value set for the noEmptyTrailingFields parameter.
Value
Description
true
Trailing empty subfields will be removed from the output.
false
A field separator remains to denote an empty subfield.
delimiters
Document. Optional. The separator characters used to construct the output string. To specify a delimiter, you can specify:
*One character or character representation (for example, *, \n for line terminator, \t for tab)
*Hexadecimal value with prefix “0X” (for example, 0X09, 0X13)
*Octal value with prefix “0” or decimal value (for example, 009, 013)
*Unicode characters (for example, \u XXXX where XXXX represents the Unicode value of the character)
Value
Description
record
String. Character to use to separate records. If you want to specify the two–character carriage return line feed (CRLF) characters, specify \r\n.
field
String. Character to use to separate fields.
subfield
String. Character to use to separate subfields.
release
String. Character to use to ignore a record, field, or subfield delimiter in a field. If a release character occurs in a field or subfield before the delimiter, it will be prefixed with release before being written to the output string.
quotedRelease
String. Character to use to ignore a record, field, or subfield delimiter in a field. If a quoted release character occurs in a field or subfield before the delimiter, it will be prefixed with quotedRelease before being written to the output string. The string is pre- and appended with the quoted release character.
For example, if * is a delimiter, the field value is a*b, and the quoted release character is “, the string appears as “a*b”.
lineSeparator
String. Optional. Character to use to override the input record delimiter when the following pre-condition is met and to handle the operating system specific newline.
The record delimiter must be either "\r\n" [CRLF] or "\r"[CR] or "\n"[LF] and the parser is of Delimiter Type.
Note:
Integration Server ignores lineSeparator if the above pre-condition is not met.
Value
Description
unix
Integration Server overrides the record delimiter with LF or "\n".
windows
Integration Server overrides the record delimiter with CRLF or "\r\n".
mac
Integration Server overrides the record delimiter with CR or "\r".
auto
Integration Server overrides the record delimiter with the operating system specific line separator.
FormatInfo
Document. Any values mapped to the FormatInfo variable will be passed unmodified to all format services invoked by convertToString and convertToValues.
outputFileName
String. Optional. If you want the output returned in a file instead of in the string output variable, provide the name of the file you want created as a result of this service.
Encoding
String The type of encoding used to write data to the output file. The default encoding is UTF–8.
Note:
If the flat file document contains multi-byte encodings, you must install the Extended Character Set using the Software AG Installer. For more information about installing the Extended Character Set, see the “Configuring the flat file byte count parser" section of the Flat File Schema Developer’s Guide.
sortInput
String. Optional. Whether you want the service to sort the input records to match the flat file schema specified in ffSchema. You should specify true for sortInput if the data in ffValues is not in the same order as defined by ffSchema.
Value
Description
true
You want the service to sort the input records to match the flat file schema.
If you select to sort the input records, note that:
*The service will run slower.
*All undefined records will be sorted after the defined records.
*The order of the undefined records appear in the final document is random.
If there are multiple records at the same level with the same name, the order they appear in the final document is random.
false
You do not want the service to sort the input records to match the flat file schema. The input records must match the order of the flat file schema. This is the default.
returnAsBytes
Value
Description
false
Returns the document as a string. This is the default.
true
Returns the document as a byte array instead of a string. This setting is useful (but optional) when parsing multi-byte encodings.
Output Variables
string
String. Data that represents the flat file document.
bytes
Object. If the input variable returnAsBytes=true, returns the output as a byte array encoded using the specified encoding. The string value is not returned.
errorArray
Object String array containing messages pertaining to errors that occurred during conversion. If no errors are encountered, this contains a value of null.
Usage Note
When the pub.flatFile:convertToString service executes, the field that is defined to start after the end of the fixed length record will not be included in the output data if the following conditions are met:
*The flat file schema uses a fixed length record delimiter.
*The flat file schema contains a fixed position field that begins beyond the defined length of the fixed length record.
*The input to the pub.flatFile:convertToString service contains a value for the fixed position field that begins beyond the defined length of the fixed length record.