Text export properties
Sample script file: TextExport.mrs
This example script is based on the Museum sample data set. See
Running the sample table scripts for information on running the example scripts.
When you export tables to a text file, you can control a number of options using the export properties. The following table lists the available export properties.
Destination
Location and filename of the exported text file.
Type: String
Default value: "" (An empty string.) When the location is not specified, the text file will be created in your default temporary folder. If you do not know where this is, you can find out by opening a command prompt and typing cd %temp%. This displays the location of the temporary folder. You can then browse to this folder in Windows Explorer to find the text output.
DisplayAnnotations
Determines whether annotations are included in the export.
Type: Boolean
Default value: True
FieldDelimiter
An integer value representing the Unicode character code (sometimes called the code point) for the character to be used to separate the fields.
Type: Long
Default value: The integer representing the code for the comma (,) character.
LaunchApplication
Launch the default application for the file type after the export has completed.
Type: Boolean
Default value: False
TableDelimiter
An integer value representing the Unicode character code for the character to be used to separate tables. (This should be different from the FieldDelimiter.)
Type: Long
Default value: The integer representing the code for the form feed character.
UseElementLabels
Determines whether element names or the more friendly element labels are to be used for the row and column labels.
Type: Boolean
Default value: True (Use labels)
UseVariableLabels
Determines whether variable names or the more friendly labels are to be used for variable texts.
Type: Boolean
Default value: True (Use labels)
Example
The following example sets the Destination, TableDelimiter, and LaunchApplication export properties.
With TableDoc.Exports.mrTextExport
.Properties["LaunchApplication"] = True
.Properties["TableDelimiter"] = AscW(";")
.Properties["Destination"] = _
"[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ _
Output\TextExport.csv"
.Export()
End With
Notice that the
TableDelimiter property has been set using the
AscW function, which returns the integer code for a given character. If you attempt to set this property (or the
FieldDelimiter property) to the character itself, you will get a "Type mismatch" error.
You should also use the AscW function if you use the mrScriptBasic
String constants to set these properties, because these constants have a string value. For example:
Export.Properties["TableDelimiter"] = AscW(mr.FormFeed)
If you set the property using one of these constants without using the AscW function to convert it to the integer value, it may be ignored and the default property value will be used instead or you may get an "An error occurred accessing the Properties property for the XML element Export" error, depending on the property's position in the collection.
Requirements
UNICOM Intelligence Reporter
See also