CSV Writer

From PresenceWiki
Revision as of 08:50, 14 July 2010 by Admin (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

CSV Writer

The CSV writer formats the current data table from the Presence Context and outputs it to a Presence variable, or to a file. Fields are separated by commas (,) by default, and rows are separated by new lines.

For example, the following table of data:

Name Country
Matt Pryor United Kingdom
Paul Rebane United States

Would be formatted as follows:

Matt Pryor,United Kingdom
Paul Rebane,United States

Table Writer Options

After dragging a CSV Writer into your Task, you will be presented with the option of automatically including all data columns, or specifying which you wish to include and which you wish to ignore. This option is available for all "standard" formatting nodes. The default is to include all columns, which has the advantage of flexibility (in case more columns are added to the preceding query at a later date), but can mean redundant information.

CSV Writer Options

Clicking on the "CSV Writer Options" button will present a Properties Tree with configurable options specific to CSV files. The options available are:

Delimiter: This is the character used to separate fields. By default it is a comma, but you can specify a different character by selecting the property name and clicking "Edit".

Writer Headers: This is a boolean value - true, or false. If true, the column names (in the example above, Name and Country) will be included as the first line of the output file.

Ouptut Chooser

After dismissing the Table Writer Options dialog by clicking Okay, the "Output chooser" dialog will be displayed. This gives the option to write the output to a file, or to a variable.

Append Existing File: If the file already exists, any output will be put at the end of the file. If the file does not exist, it will be created.

File is Temporary: When the Presence Task completes the created file will be deleted. This option is typically used when the file is to be transferred elsewhere, for example via FTP Upload or as an Email attachment.

Please also see Advanced File Options.

If the output is to be written to a variable, select that option from the dropdown list and specify the name of the variable that should store the formatted text.

See Also

Task Elements > Data Format Nodes > CSV Writer

CSV Writer | HTML Table Writer | Basic XML Writer | XML Document Writer
XSLT Processor | Padded Text Writer | Custom Data Formatter Standard Option | Custom Data Formatter PDF Option
Custom Nodes

Task Elements | Resources