Altova MapForce 2025 Enterprise Edition

ic-store-csv

Store CSV allows you to store text fragments as CSV text, and map individual columns to MapForce. Any number of CSV containers/components can be created in FlexText, and each of the CSV containers may have different separators.

 

The Sample Text pane provides an overview of the current CSV fragment, and also allows you to specify individual field names, and field types. Each column appears as a mappable item in the FlexText component in MapForce.

 

Container default settings are:

 

Record separator

CR LF

Field separator        

,

Quote character        

"

Add quote character always

no

Escape character

(none)

First row contains field names

no

Treat empty fields as absent

yes

 

The following example shows how data in a small text file is split up into two CSV files, and mapped to separate XML files in MapForce.

fl-csv-2

The Split once container shown above, is used to create two containers. The delimited (line based) function with the separator 222, is used to achieve this. All records up to the first occurrence of 222, are passed to the CSV container. The first, consisting of all records containing 111, is then defined as a CSV container. The Sample Text pane shows the contents of the currently active container "Split once".

fl-csv-3

The default CSV settings have not been changed. Clicking the CSV container shows its contents in tabular form.

fl-csv-3a

The second container holds the remaining data, and is made into another Split once container. This creates two more containers, one of which will be the second CSV. Clicking the Split once container, shows the current contents.

fl-csv-4

The delimited (line based) function, using 1100 as the separator, is used to split the remaining data into two sections.

 

All records up to the first occurrence of 1100, are passed to the first container which is made non-mappable, by defining it as "Ignore" ic-ignore.

The second container is then defined as CSV. The default settings have not been changed. Clicking the CSV container shows the contents in tabular form.

fl-csv-1

Inserting the FlexText template into MapForce allows you to map the data to any of the supported target files. In this example, each of the CSV items are mapped to two separate XML files.

fl-csv-5

Note that not all of the items in the CSV sections are mapped to the target files. The first XML file contains all 111 record types.

fl-csv-6

The second XML file contains all records starting with 1100.

fl-csv-7

 

Configuring the CSV container/data

fl-csv-1

Clicking a field in the Sample Text pane highlights it, allowing you to configure it further.

 

Click in the Name field to edit the default text that is presented.

Click in the Type field to define the field data type: string, boolean, decimal etc.

Click the append icon ic-csv-append to append a new field.

Click the insert icon ic-csv-insert to insert a field before the currently active field.

Click the delete icon ic-csv-del to delete the currently active field.

 

Note:The field boundaries can be dragged by the mouse to display the data.

 

Add quote character always

Allows you define if the specified quote character is to be added to all fields of the generated CSV file.

 

Treat empty fields as absent

Allows you to define that empty fields in the source file, will not produce a corresponding empty item (element or attribute) in the target file.

 

Note that the delimiters for the empty fields in the source file must exist however, e.g. "General outgassing pollutants,,,,".

© 2018-2024 Altova GmbH