Log In    |    Knowledge Base    |    4D Home
Tech Tip: Creating and opening a 4D data file on the fly using version 6.8
Published On: May 2, 2002

Starting with version 6.8, two new commands are available that allow for the creation and opening of a 4D data file on the fly.

- OPEN DATA FILE (accessPath)

You pass the name or the full access path of the data file to open in the accessPath parameter. If you pass only the file name, it must be placed next to the structure file of the database.

If the access path sets a valid data file, 4D quits the database in progress and re-opens it with the specified data file. The database methods On Exit and On Startup are successively called.

The command is executed in an asynchronous manner: after its call, 4D continues executing the rest of the method. Then the application behaves as if the Quit command was selected in the File menu: open dialog boxes are cancelled, any open processes have 10 seconds to finish before being terminated, etc.

- CREATE DATA FILE (accessPath)

The general functioning of this command is identical to that of the OPEN DATA FILE command; the only difference is that the new data file set by the accessPath parameter is created just after the structure is re-opened. Before launching the operation, the command verifies that the specified access path does not correspond to an existing file.