Altova MapForce 2022 Enterprise Edition

Using FlexText as a Target Component

Home Prev Top Next

The main use of FlexText components is to reduce, or split off sections of text files and map the relevant items of the FlexText component to other target components. FlexText can, however, also be used as target component to assemble or reconstitute separate files into a single file, although this can entail a fair amount of trial and error to achieve the desired results.


Using a FlexText component as a target reverses the operations previously defined in it. Instead of splitting a file into various subsections, you assemble/reconstitute a file.


In general, the inverse of each operation defined in the FlexText template is carried out (in a bottom-up fashion) when using it as a target:


"Split" becomes "merge", e.g. mapping to a repeated split delimited by "," becomes a merge items separated by ",".

"Store" becomes "load".

"Switch" becomes "choose the first match".


Note the following when using FlexText as target components:


As soon as a connection is made between a data source component and one of the input items of a FlexText component, the FlexText component data source is ignored. The data provided by the newly mapped source component now takes precedence.

If text is mapped to a "Store as..." (Store as CSV and FLF) container, then the separator is retained. However, text might be truncated if a fixed length split occurs in a node above the "Store as..." node.

Fixed Width Splits truncate the left/top section if Split Base=Head, or the right/bottom section if Split Base=tail, to the predefined length. The truncated section is then as long as the defined length in characters. If the text is too short, then space characters are inserted to pad the section.

FlexText would normally insert separators (or white space for fixed splits) between the items of a split operation, but this is not the case for 'delimited (line based)' splits. The 'delimited (line based)' operation is not a perfectly reversible operation. The "Delimited" text may occur anywhere in the first line and is included in the text, and therefore an automatic process cannot reliably add it.

oDelimited (line based), will not add a separator to the first line if it is missing.

oDelimited (floating), will add a separator between two sections.

The switch operation cannot be inverted in a meaningful way except for simple cases. The switch scans its branches for the first branch that contains data, and uses/inserts this data. Only the first connection of a switch operation is mapped. To transfer data to the remaining switch containers, filters have to be defined for the remaining connectors and the duplication of the switch parent item is necessary, so that each switch item returns a single item which is then fed to a repeated split item to merge all of them.

Mapping to a child of a single split container discards all mapping results except for the last item. Only a single result is retained, even if multiple results were generated.


The following analogy to the XML Schema content model gives some idea of FlexText's behavior when used as a target:


A repeated split is a repeatable element.

A single split forms part of a 'sequence' content model group.

A switch forms a 'choice' content model group, each case being a possible child element.

A store creates an element of simple type.

© 2016-2022 Altova GmbH