Salesforce

DataViewToText (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

DataViewToText (Magic xpa 3.x)

Creates a text file from the data view variables sent to it.

Syntax:

DataViewToText (generation, task var names, print var names, output file name, delimiter string, string identifier, charset)

Parameters:

generation: Numeric. A number that represents the task's hierarchic position in the runtime task tree. 0 represents the current task, 1 its immediate ancestor, and so on.

task var names: Alpha. A comma-delimited list of all the names of the variables that will be exported. These are the names referred to in the Field Description property of the column.

print var names: Alpha. A comma-delimited list of all the descriptions of the variables that will be exported. These names will print on the first line of the output. If this is going to Excel, then Excel uses these names as the headers in the spreadsheet. These are associated with the variable names based on the position. If this string is empty, there will be no field headers. If you want to use the variable names as the header line, just enter '@'. If the name has a comma, it will be prefixed by the backslash (\) character.

output file name: Alpha. The name of the file that will be created.

delimiter string: Alpha. The string that will be sent as a delimiter.

string identifier: Alpha. This is the character that will be inserted before and after a text string (Alpha and Unicode).

charset: Numeric. Defines the character set for the outputted data. The following values are valid:

  • 0 – ANSI

  • 1 – Unicode

  • 2 – UTF-8

Returns:

Success – a logical value.

Usage:

You can use this function in any of the following ways:

  1. In an Online or a Rich Client interactive task that browses the data – if you want to export the current data view.

  2. In a Batch or a Rich Client non-interactive task – if you want to export data without browsing it.

    In this case, since the function itself generates and scans the data view, the task that holds the data view definition can end without scanning the records. This task can be defined as follows:

  1. Define the Main Data Source with the data source and ranges on columns according to the data you want to export.

  2. Call the function in the Task Suffix logic unit.

  3. Set the End task condition to Yes and the Evaluate condition to Before entering record. This way the task will not scan all of the records.

Note:

  • If you often need to export the entire data view, you can create a function that uses the DataViewVars() function to create a list of all the data view variables on the fly, so you don't have to type them in.

  • If the file cannot be created or if the Variable list is empty, the function will return False.

  • If a delimiter string or string identifier are not provided, they will be assumed to be “None”.

  • If the Variable Names list is shorter than the variables, the subsequent variables will not have headers (i.e the headers will be empty).

  • If the Variable Names list is longer than the variables, the extra variable names will be ignored.

  • If the charset evaluates to an invalid value, 0 for ANSI will be assumed.

  • If a name in the Task Vars List is an invalid field, the function will return False.

  • If a name in the Task Vars List is OLE, BLOB, .NET or Vector, the function will return False.

Exceptions:

This function is not supported for Web Service databases.

See also:

How Do I Export Data into a Text File?

How Do I Export Data into a CSV File?

The Online and Rich Client Samples projects (program RP02, RP02b and RRP02, RRP02b)

Reference
Attachment 
Attachment