File System - Dataset to CSV

Declaration

<AMFILESYSTEM ACTIVITY="dataset_to_csv" DESTINATION="C:\temp\Archive\dest.csv" RESULTDATASET="myDataset" DELIMITER="semi_colon" OVERWRITE="YES" />

Description:

Retrieves data currently populated in a dataset and outputs the data onto a comma-separated values (CSV) file.

Practical Usage

Used to the movement of data between programs that natively operate on incompatible (often proprietary) formats. For example, a user may need to transfer data previously populated onto a dataset (with the use of the CSV to dataset activity), and output the data onto a new CSV file.

Parameters

General

Property

Type

Required

Default

Markup

Description

Dataset

Text

Yes

(Empty)

RESULTDATASET="myDataset"

The name of the dataset from which to extract data.

Destination

Text

Yes

(Empty)

DESTINATION="c:\temp\file.csv"

The path and filename of the .csv file in which to output the data. This can be a fully qualified path and filename (preferred) or a /filename only (requires use of the Change Folder activity).

Overwrite if file already exists

Yes/No

No

No

OVERWRITE="YES"

If set to YES, matching destination files will be overwritten. If set to NO (default), matching files will not be overwritten, however, a runtime error will occur when a matching file exists.

Advanced

Property

Type

Required

Default

Markup

Description

Include column names

Yes/No

No

Yes

INCLUDECOLUMNNAMES="NO"

If set to YES, will treat the first line of the CSV data as column headers. If set to NO, column headers are ignored.

Delimiter

Text (options)

Yes

Comma

  1. DELIMITER="semicolon"

  2. DELIMITER="tab"

  3. DELIMITER="space"

  4. DELIMITER="custom"

The character to be used to separate the tabular values once they are extracted to the .csv file. The available options are:

  • Comma (default) - A comma is used as a delimiter.

  • Semicolon - A semicolon is used as a delimiter.

  • Tab - A tab is used as a delimiter.

  • Space - A space character is used as a delimiter.

  • Custom - Displays the "Custom delimiter text" field in which to specify a single custom character or custom set of characters to use as delimiter.

Description

Error Causes

On Error

Example

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: This sample task retrieves folder information and populates a dataset with results. The dataset is then written to a CSV file.

NOTE: In order for this task to work, please modify the SOURCE and DESTINATION to locations that are applicable to your system.

<AMFILESYSTEM ACTIVITY="get" MODE="folder" SOURCE="C:\temp" RESULTDATASET="theFolderInfo" FILEPROPERTY="fullname" />

<AMFILESYSTEM ACTIVITY="dataset_to_csv" DESTINATION="c:\temp3\theFolderInfo.csv" RESULTDATASET="theFolderInfo" OVERWRITE="YES" />