Flat file predefined operations
Learn about the available predefined flat file operations.
convertFlatFileToDocument
Converts flattened flat file data into structured data that conforms to the document type associated with the flat file connector.
Input variables
| Variable | Description |
|---|---|
| ffDataString | String. The flat file input with type of String. |
| ffData | Object. The flat file input with type of InputStream or ByteArray. If both ffData and ffDataString are parsed, ffDataString takes precedence. |
| ffIterator | Object. Optional. An object that encapsulates and tracks the input data during processing. It is used only when the iterated variable is set to true. |
| encoding | String. Optional. The encoding of the InputStream passed in to ffData. The default encoding is UTF–8. |
| delimiters | Document. Optional. A document object that contains the segment terminator and the field and
subfield separators. If the delimiter is null, it is located using the information
that is defined in the definition and structure of the Flat File connector. To specify a delimiter,
you can specify: |
| One character or character representation (for example, *, \n for line terminator, \t for tab) | |
| The space character | |
| record | String. Character that is used to separate records. If you want to specify the two–character
carriage return line feed (CRLF) characters, specify \r\n. |
| field | String. Character that is used to separate fields. |
| subfield | String. Character that is used to separate subfields. |
| release | String. Character used 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 is prefixed with the release. |
| 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 is 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”. |
| iterate | String. Optional. Whether you want to process the input all at one time. Valid values are
true and false. |
| batchsize | String. Optional. Whether you want to process the specified number of records. The input value of this field is a positive integer. It is applicable only when the iterated field value is set to true. If you do not specify this field value, the default value is set to 1. |
| createIfNull | String. Optional. Whether to create the document object if all the fields are null. |
| skipWhiteSpace | String. Optional. Whether white space at the beginning of records will be ignored. |
| keepResults | String. Optional. Whether to return the parsed data. |
| validate | String. Optional. Whether to return error messages that describe how ffData differs from the definition and structure of the Flat File connector. |
| returnErrors | String. Optional. Whether to return the validation errors. |
| maxErrors | String. Optional. The maximum number of errors that can be returned from one record. When the flat file parser encounters more than the maximum number of errors within a record, the parser will stop parsing and return the parsed data and errors that are processed up until that point. |
| flags | String. Optional. Flags that you can set to govern the convertFlatFileToDocument options. |
| addRecordCount | String. Whether you want the operation to add an additional field (@record–count) to each parsed record in the resulting document object. |
| detailedErrors | String. Whether you want detailed conditional validation error information. |
| skipToFirstRecord | String. Whether you want the operation to wait until it finds the first valid record before reporting invalid records as errors. |
| trimWhitespace | String. Whether you want the operation to delete any blank spaces at the beginning of fields, at the end of fields, or both. |
| resultAsArray | String. Whether you want the operation to return the document object that represents the input flat file data as a document reference that can be mapped to the document types generated. |
Output variables
| Variable | Description |
|---|---|
| _dt | Document. The name of the output document is flatfile_application_name_dt, where flatfile_application_name is the name of the flat file application. For example, if the connector name is test, then the name of the output document will be test_dt. The structure of the output document will be similar to what you have defined in your Flat File connector. |
| isValid | String. Whether flat file contains validation errors. |
| errors | String. Optional. An array containing the validation errors, if any, that were found in ffData or ffDataString. |
| hasMore | String. Optional. Indicates when the iteration is terminated. Use this variable as a
condition to break the batching loop. This is applicable only when the iterated input is set to
true. Valid values are:
|
convertDocumentToFlatFile
Converts a structured data conforming to the given document type structure associated with the connector, to the flattened flat file data.
Input variables
| Value | Description |
|---|---|
| <flatfile_application_name>_dt | Document Structure conforming to the Document type created for the corresponding application of this operation. |
| spacePad | String. Optional. How to position the records in the flat file. |
| signalError | String. Whether to create errors in the output. |
| noEmptyTrailing Fields | String. Whether trailing empty fields are to be removed from the output. Used only with records that have delimited fields. |
| 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, webMethods Integration uses the value set for the noEmptyTrailingFields parameter. |
| 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) |
| 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 is 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 is 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”. |
| FormatInfo | Document. Any values mapped to the FormatInfo variable will be passed unmodified to all format operations invoked by convertDocumentToFlatFile and convertFlatFileToDocument. |
| Encoding | String. The type of encoding used to write data to the output file. The default encoding is UTF–8. |
| sortInput | String. Optional. Whether you want the operation to sort the input records to match the definition and structure of the Flat File application. |
| returnAsBytes | Returns the document as a string or as a byte array instead of a string. |
Output variables
| Variable | Description |
|---|---|
| string | String. Data that represents the flat file document. |
| bytes | Object. The output is returned as a byte array, encoded with the specified encoding, if the input variable returnAsBytes is set to true, instead of as a string value. |
| errorArray | Object. A string array that holds messages that are related to errors that occurred during the conversion process. |
Usage notes
When the convertDocumentToFlatFile operation runs, the field that is defined to start after the end of the fixed-length record is excluded from the output data if these conditions are met:
- The definition and structure of the Flat File connector uses a fixed-length record delimiter.
- The definition and structure of the Flat File connector contains a fixed position field that begins beyond the defined length of the fixed-length record.
- The input to the convertDocumentToFlatFile operation contains a value for the fixed position field that begins beyond the defined length of the fixed-length record.