|Text File Data Target|
|Writes data from to a delimitated or fixed width format file (CSV etc).|
Creating an Text File Target
When the Text Writer component is dragged onto a transform a setup wizard is launched to guide you through the creation of the data target.
If you already have an example of an output file then you can use this to define the structure that will be used for your writer.
The "Read structure from existing sample document" runs another wizard that allows you to define the structure of your document based on an existing file format.
There are 2 forms of file delimited and fixed width, delimited files use a special character to separate fields, fixed width pad all the fields so they take up the same amount of space.
Some files also contain the column names on the first row.
Select the options that are applicable and press Next.
Delimited File Configuration
If your file was delimitated, then the next screen allows you to define the rules used to read each field.
The delimiters break the fields, its possible to select a number of delimiters, but in practice the file normally only uses a tab or a comma.
The "Fields are enclosed in quotes" property means that if the first char within a field is a quote then the value is considered to be everything up to the next quote. This makes it possible for a field to contain the delimiter character. If the field also needs to contain a quote char then 2 quote chars in a row are interpreted as a single quote.
|Data||Field 1 Value||Field 3 Value||Field 3 Value||Field 4 Value|
Column Details Page
If your source data contained column headings then you may well be finished at this stage, however if the data contains no column information, or you don't like the names in the file then you can change them on this page.
Simply select the column to edit and set the name (if you are working on a fixed width file then you also get the option to set the column width).
|If you did not provide a source document to infer the structure from then you must define it here by hand.|
The default filename that will be used to write out the new text file. If this is not specified then the input connection point 'Filename' must be connected.
This provides a simple way to write to a single file, if you need to create multiple files or construct the filename dynamically, then leave this blank.
Once you press Finish the new Text Data target is added to the transform and can be used as any other data target is.
The name of the component, must be unique within the transform
Allows the column definitions to be manually edited.
Default output filename
If the writer component does not have a connector to the 'Filename' input then the filename the data is written to is taken from this property.
If the connection point 'Filename' is connected, then this property is ignored (and can be blank)
Store as relative path
Indicates that the filename is to be resolved relative to the data mapping file (.dm). If the transform is compiled the filename will be resolved relative to the compiled exe.
The encoding used to write the text data to a file.
Write column heading on first line
If checked then all the column headings are written onto the first line of the file.