Text File Mapping
FlexText Utility Highlights:
- Extract data from reports, log files, and other text documents
- Visual file parsing
- Real-time output preview
- Template creation for recurring use
- Integrates with MapForce for complex data mapping
Convert Text Files with Ease
Altova MapForce® 2017 includes the unique FlexText utility for parsing and converting text files such as mainframe text reports, text-based log files, and other legacy text file types in mapping designs. With its visual interface, FlexText lets you insert an existing text file and extract the portions you want to convert in the MapForce mapping interface.
FlexText produces a template that is then loaded into MapForce, where individual text nodes can be converted to any combination of XML, database, EDI, XBRL, flat file, Excel, JSON, and/or Web service data. By saving the configuration you create in FlexText, you can reuse the same template to convert multiple text files in multiple mappings.
FlexText allows you to create rules for text file conversion templates. When you open a text file in the FlexText interface, the file is displayed in two blocks. The root block represents the original file, while the operation block (to its right) displays the data of the file in real-time as you extract the data you need.
The result of every operation you make is visible in real-time, so you can immediately see if you’ve achieved the desired result.
Extract Relevant Data
FlexText allows you to isolate the data you need to access by removing non-relevant text, characters, and whitespace using split commands. Each split presents your data in two new blocks: one that contains the data you have split out, and another displays the modified view of your converted file. You can immediately see the result of each operation you perform.
The split operation is highly configurable, allowing you to select fixed length or delimited (line based or floating) mode for each split. For a fixed length split, you specify the number of lines to remove working from either the head or the tail end of the text file. In delimited mode, you choose standard separators (e.g., line feed, tab, comma, etc.) for each split or enter your own text-based delimiter. Both horizontal and vertical splits are supported.
Node, Ignore, and Switch
FlexText supports Node and Ignore operations for further flexibility in constructing the information tree. An Ignore operation marks a block of text as irrelevant for conversion purposes and instructs MapForce to ignore it. The Node operation creates a new node in the information tree in MapForce so that you can properly represent the hierarchical nature of your text data when needed.
The Switch operation allows you to define multiple conditions for a single block of text. If data in the text file meets a condition, it is passed to the associated container for use in your MapForce conversion. If data does not meet a given condition, it is forwarded to the default container.
Embedded CSV or FLF
Legacy text files may contain useful data in CSV (comma-separated values) or FLF (fixed length field) formats inside a more complex flat file. FlexText allows you to directly extract such data using the CSV and FLF operations. After applying Split and other operations, you can store remaining CSV- or FLF-formatted fields by configuring the field names, lengths, etc.
Regular Expressions in FlexText
FlexText is enhanced with support for regular expressions. In the partial FlexText mapping shown to the right, the input file is a system-generated report with numbers and letter codes in the left margin that indicate record types. For instance, a sequence of any five digits followed “O” indicates the beginning of a new section for one office location.