Setting the FLF Options
After you add a text component to the mapping area, you can configure the settings applicable to it from the Component Settings dialog box. You can open the Component settings dialog box in one of the following ways:
•Select the component and, on the Component menu, click Properties.
•Double-click the component header.
•Right-click the component header, and then click Properties.
Text Component Settings dialog box (in fixed-length field mode)
The available settings are as follows.
The component name is automatically generated when you create a component. However, you can change the name at any time. The component name can contain spaces and full stop characters. It may not contain slashes, backslashes, colons, double quotes, leading and trailing spaces. If you want to change the name of the component, be aware of the following:
•If you intend to deploy the mapping to FlowForce Server, the component name must be unique.
•It is recommended to use only characters that can be entered at the command line. National characters may have a different encoding in Windows and at the command line.
Specifies the file from which MapForce will read data. This field is meaningful for a source component and is filled when you first create the component and assign to it a text file. The field can remain empty if you are using the text file component as a target for your mapping.
In a source component, MapForce uses the value of this field to read column names and preview the contents of the instance text file.
To select a new file, click Input File.
Specifies the file to which MapForce will write data. This field is meaningful for a target component.
To select a new file, click Output File.
Save all file paths relative to MFD file
When this option is enabled, MapForce saves the file paths displayed on the Component Settings dialog box relative to the location of the MapForce Design (.mfd) file. This setting affects the input and output files used by the text component. See also Using Relative Paths on a Component.
Input / Output Encoding
Allows you specify the following settings of the output instance file:
•Whether the byte order mark (BOM) character should be included.
By default, any new components have the encoding defined in the Default encoding for new components option. You can access this option from Tools | Options, General tab.
This option allows you to define the characters that are to be used to complete, or fill in, the rest of the (fixed) field when the incoming data is shorter than the respective field definitions. The custom field allows you to define your own fill character.
If the incoming data already contains specific fill characters, and you enter the same fill character in the Custom field, then the incoming data will be stripped of those fill characters!
Assume record delimiters present
This option is useful when you want to read data from a source flat file that does not contain record delimiters such as CR/LF, or when you want to produce a target flat FLF file without record delimiters.
See the Understanding the "Assume record delimiters present" option section below.
Treat empty fields as absent
When this option is enabled, empty fields in the source file will not produce a corresponding empty item (element or attribute) in the target file.
Assuming that the output is an XML file, when this option is disabled, the empty fields will be created in the output with an empty value (in this example, the elements Last, Title, and Email):
When this option is enabled, the empty fields will not be created in the output:
CSV / Fixed
Changes the component type to either CSV or FLF (fixed-length field).
The lower part of the dialog box displays a preview of up to 20 rows of the file selected as input or output.
If necessary, you can create the structure of the file (or change the structure of the existing one), as follows.
To change the name of a field, click the header (in this example, Field1), and type the new value.
To change the data type of a field, select the required value from the drop-down list. MapForce checks the data type, so if the input data and the field format to do not agree, then the data is highlighted in red.
To set the size of the field in characters, enter the field size in the third row from the top.
To better understand this option, open the Altova-FLF.txt file available in the <Documents>\Altova\MapForce2023\MapForceExamples\Tutorial\ folder. Notice that the file consists of 71-character long records, without any delimiters such as CR/LF. If you would need to read data from this particular file, first you would need to split this file into records. That is, create several fields whose total size sums up to 71 characters (as shown below), and then disable Assume record delimiters present. For a step-by-step example, see Example: Mapping Fixed-Length Text Files to Databases.
If you would need to write data from this file to a destination file which uses the same structure, then enabling Assume record delimiters present creates a new record after every 71 characters.
The mapping result when "Assume record delimiters present "is enabled
If Assume record delimiters present is disabled, the mapping result appears as one long string.
The mapping result when "Assume record delimiters present "is disabled