IMPORT DATA

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 2003 (Modified)


IMPORT DATA (fileName{; project{; *}})

ParameterTypeDescription
fileNameStringAccess path and name of the import file
projectBLOBContents of the import project
New contents of the import project (if the *
parameter has been passed)
**Displays the import dialog box and
updates the project

Description

The IMPORT DATA command allows you to import the data located in the fileName file. 4D can import the data in the following formats: Text, Fixed length text, XML, SYLK, DIF, DBF (dBase), and 4th Dimension.

If you pass an empty string to fileName, IMPORT DATA displays the standard save file dialog box, allowing the user to define the name, type, and location of the import 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 set to 0.

If you do not pass the optional parameter project, the import dialog box is displayed. The user can define then import parameters or load an existing import project.

Note: An import project contains all the import parameters such as the tables and fields in which to import, the delimiters to use, and so on. Those parameters are defined in the import dialog box. An import project can be saved to disk to be loaded and used later. For more information about the import dialog box, please refer to the 4DUser Mode manual.

If you pass a BLOB containing a valid import project in the project parameter, the import will be directly performed and will not require the user's intervention. The project must already be predefined in the import dialog box, then saved. To do so, you have two possible solutions:

- Save the project to disk, then load it, using the DOCUMENT TO BLOB command, in a BLOB field or a BLOB variable that you pass in project.

- Use the IMPORT DATA command with an empty project parameter and the optional parameter *, then store the project parameter in a BLOB field (see below). This solution allows you to save the project with the datafile without having to load it from a BLOB located on the disk.

Note: Refer to the EXPORT DATA command for an example concerning the definition of an empty project.

The optional parameter *, if it is specified, forces the display of the import dialog box with the import parameters set as they were 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 import dialog box, the parameters of the "new" project. You can then store the new project in a BLOB field, on disk, and so on.

If the import was successful, the OK system variable is set to 1.

See Also

EXPORT DATA, IMPORT DIF, IMPORT SYLK, IMPORT TEXT.

System Variables and Sets

If the user clicks Cancel in the standard save file dialog box or in the import dialog box, the OK system variable is set to 0. If the import was successful, the OK system variable is set to 1.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next