version 2003 (Modified)
EXPORT DATA (fileName{; project{; *}})
Parameter | Type | Description | |
fileName | String | Full path name of the export file | |
project | BLOB | Contents of the export project | |
New contents of the export project (if the * | |||
parameter has been passed) | |||
* | * | Displays the export dialog box and updates | |
the project |
Description
The EXPORT DATA command allows you to export data in the fileName file. 4D can export data in the following formats: Text, Fixed length text, XML, SYLK, DIF, DBF (dBase), and 4D.
If you pass an empty string in fileName, EXPORT DATA displays the standard save file dialog box, allowing the user to define the name, type, and location of the export file. Once the dialog box has been accepted, the Document system variable contains the access path and the name of the file. If the user clicks Cancel, the execution of the command is stopped and the OK system variable is equal to 0.
If you don't pass the optional parameter project, the export dialog box is displayed. The user can define the export parameters or load an existing export project.
Note: An export project contains all the export parameters such as the tables and fields to export, delimiters, etc. You define these parameters in the export dialog box. A project can be saved to disk and then loaded. For more information about the export dialog box, please refer to the 4D Design Reference manual.
If you pass a BLOB containing a valid export project to the project parameter, the export will be directly performed, without the user intervening. The project must already be predefined in the export dialog box, then saved. To do so, you have two possible solutions:
- Save the project to disk, then load it by using the DOCUMENT TO BLOB command, in a field or a variable of type BLOB that you pass to the project parameter.
- Use the EXPORT DATA command with an empty project parameter and the optional parameter *, then store the project parameter in a field of type BLOB (see below). This solution allows you to save the project with the datafile without having to load it from a BLOB on disk.
The optional parameter *, if it is specified, forces the display of the export dialog box with the parameters defined in project. This feature allows you to use a predefined project, while still having the possibility to modify one or more of the parameters. Furthermore, the project parameter contains, after closing the export dialog box, the parameters of the "new" project. You can then store the new project in a BLOB field, on disk, etc.
If the export was successful, the OK system variable is equal to 1.
Example
This example creates an empty project and stores the parameters set by the user in the export dialog box there:
C_BLOB($exportParams) SET BLOB SIZE($exportParams;0) `Initialization of BLOB EXPORT DATA("DocExport.txt";$exportParams;*) ` Display of the export dialog box
See Also
EXPORT DIF, EXPORT SYLK, EXPORT TEXT, IMPORT DATA.
System Variables and Sets
If the user clicks Cancel in the standard open file dialog box or in the export dialog box, the OK system variable is equal to 0. If the export was successful, the OK system variable is equal to 1.