Salesforce

DataViewToXML (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

DataViewToXML (Magic xpa 4.x)

Creates an XML file from the data view variables sent to it.

Syntax:

DataViewToXML (generation, task var names, print var names, XML file name, schema file name, template file name, 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 variables that will be exported.

print var names: Alpha. A comma-delimited list of all the field names of the variables that will be exported. If the list is evaluated to ‘@’, then the engine will export the headers as defined in the task. If the name has a comma, it will be prefixed by the backslash (\) character.

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

schema file name: Alpha. The name of the schema file that will be created. This is optional. If this is blank, no schema file will be created.

template file name: Alpha. The name of the template file that will be used when creating the XML file. This is optional.

charset: Numeric. Defines the character set for the resulting 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 the XML file cannot be created, the function will return False.

  • If the schema file cannot be created, it will not be created and an entry will be added to the error log file: “XML schema file could not be created”.

  • If the template file cannot be opened, it will be ignored.

  • If the Variable list is empty, the function will return False.

  • If the Variable Names list is evaluated to ‘@’, then the engine will export the headers as defined in the task according to the Variable list.

  • 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 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.

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

Exceptions:

This function is not supported for Web Service databases.

See also:

How Do I Export Data into an XML File?

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

Reference
Attachment 
Attachment