Salesforce

How Do I Export Data into a Text File? (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Export Data into a Text File? (Magic xpa 2.x)

You can use the DataViewToText() function to export data from your program into a text file. This function gives you, as the programmer, the most control over the export, so you can, if you choose, limit which records can be exported.

Using DataViewToText()

DataViewToText() will export the current data view, either in the current task or its ancestors. The syntax is:

DataViewToText(Generation, VariableList, HeaderList, DelimiterString, StringIdentifier, CharSet)

Where:

  • Generation is the task’s hierarchic position in the runtime task tree. Zero for the current task, 1 for the task’s parent, etc.

  • VariableList is a list of the variable names you want to export. This is the text name of the variable, as it appears in the Data View section of the task. The names are separated by commas (no spaces between variable names, and case matters).

  • HeaderList is a list of titles that will be used in the export file. In our example, we used “Studio Code” for the “Code” field, to make the output more readable. If the string is empty, no headers will be sent. If the string is ‘@’, the variable list will be used as the header list.

  • DelimiterString is the string that will separate the values. In our example, we used ASCIIChr(9) to use the Tab character.

  • StringIdentifier is a string that will print before and after a string in the output. In our example, each string is surrounded by double quotes.

  • CharSet is a number that sets the character set to be used: 0=ANSI, 1=Unicode, 2=UTF-8.

The result from our sample is shown below. The tab character doesn’t show, but you can see how it has moved the data into specific columns.

See also

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

Reference
Attachment 
Attachment