4D v16.3OPEN DATA FILE |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
OPEN DATA FILE
OPEN DATA FILE
The OPEN DATA FILE command allows changing the data file opened by the 4D application on-the-fly. Pass the name or the full access path of the data file to open (file with a ".4DD" suffix) 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. In single-user mode, the On Exit database method and the On Startup database method are successively called. Warning: Since this command causes the application to quit before re-opening with the specified data file, it must be used with precaution in the On Startup database method or in a method called by this database method, so as to avoid generating an infinite loop. 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. Before launching the operation, the command checks the validity of the specified data file. Also, if the file was already open, the command verifies that it corresponds to the current structure. If you pass an empty string in accessPath, the command will re-open the database without changing the data file. 4D Server: Beginning with 4D v13, this command can be executed with 4D Server. In this context, it makes an internal call to QUIT 4D on the server (which causes a dialog box to appear on each remote machine indicating that the server is in the process of quitting) before opening the designated file. In the context of deploying a merged application, you want to open or create the user data file in the On Startup database method. This example uses the default data file (see Data file management in final applications): If(Data file="@default.4dd")
See also
|
PROPERTIES
Product: 4D
HISTORY
Created: 4D v6.8 ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||