The Flat File Wizard creates a schema that defines the
format of a flat file based on sample data that you provide. The Read
Flat File activity uses this schema to convert flat files into
an XML document.
For the best results, provide sample data that
is like the actual data. For example, if the actual data contains
header and footer rows, provide sample data with a header row for
field names and footer rows. If the actual data contains quoted fields,
the appropriate fields in the sample data should be quoted fields
as well.
The Flat File Wizard only reads the first 1000 lines
of a file. If the sample file contains more than 1000 lines and contains
footer rows, remove lines before the footer rows so that the total
line count stays within the 1000 line limit.
Important: All
rows in your sample data must have the same number of fields.
To
use the Flat File Wizard:
- From the Studio menus select The Flat
File Wizard opens in a tab in the Studio workspace.
- Enter sample data into the Sample Data text
box or click Browse... to load a sample file.
- Click Next >. The File Format page
opens.
- Choose one of the file format options:
- Character-delimited format (including Comma Separated
Values format) - Choose this option when each line in
the file has a record with fields separated by a single character,
such as a comma or tab.
- This file is in another format - Choose
this option when your file does not meet the criteria of the previous
file format option. If you select this option, you cannot use the
Flat File Wizard to create a schema for your flat file.
- Click Next >. The Field Delimiters page
opens.
- Select a field separator from the Fields separated
by list. If you select Other:,
specify the field separator in the field that displays to the right.
- If the field is enclosed by a specific character, select the character
that encloses the field from the Fields enclosed by list.
If you select Other:, specify the enclosing
character in the field that displays to the right.
- Click Next >. The Header &
Trailer page opens
- Specify whether header and trailer rows exist:
- Select Treat first row as header for field names,
if a header row exists.
- Select Treat last __ row(s) as trailer,
if a trailer row exists and specify the row number.
- Click Next >. The Edit Schema
Name page opens.
- Enter a schema name.
Tip: Choose a schema name that
describes the data and file format.
- Click Finish. In the Project tab
of the Studio Toolbox, the flat file schema you
just created displays in the Flat File Schemas directory.
To read the flat file you created and convert it to
XML:- Add the Read Flat File activity to an orchestration.
- In the Checklist, select Configure.
The Configure pane opens.
- In the Select a Flat File Schema field,
specify the name of the flat file schema you have created.
To convert XML data to a flat file:- Add the Write Flat File activity to an
orchestration.
- In the Checklist, select Configure.
The Configure pane opens.
- In the Select a Flat File Schema field,
specify the name of the flat file schema you have created.