4D v15

Default data file in merged applications

Home

 
4D v15
Default data file in merged applications

Default data file in merged applications  


 

 

Default data file management in merged applications (stand-alone and client-server merged applications) has been modified in 4D v15:

  • Developers are now able to define a "default data file" at the application building stage.
  • When no data file is found, if a "default data file" is detected, it is automatically opened silently in read-only mode by 4D.

These new features give developers better control over data file creation and/or opening when launching a merged application for the first time. More specifically, the following cases are covered:

  • Avoiding the display of the 4D "Open Data File" dialog box when launching a new or updated merged application. You can detect, for example in the On Startup database method, that the default data file has been opened and thus execute your own code and/or dialogs to create or select a local data file.
  • Allowing the distribution of merged applications with read-only data (for demo applications, for instance).

4D v15 now offers a simple way to embed a default data file into a merged application, so that the application can be installed or updated on end-user machines without using an additional dialog box. To define a default data file:

  • The developer must provide a default data file (named "Default.4DD") and store it in a default folder (named "Default Data") inside the database package (4dbase). This default data file must be provided along with all other necessary files, depending on the database configuration: index (.4DIndx), external Blobs, journal, etc. It is the responsibility of the developer to provide valid default data files. Note however that since a default data file is opened in read-only mode, it is recommended to uncheck the "Use Log File" option in the original structure file before creating the data file.
  • When the application is built, the default data folder is integrated into the merged application by the application building process. All files within this default data folder are also embedded.

The following graphic illustrates this new feature:

When the default data file is detected at first launch, it is silently opened in read-only mode, thus allowing you to execute any custom operations that do not modify the data file itself.

When launching a merged application for the first time, 4D tries to select a valid data file. In previous releases, if no default data file (same name and same level as the .4dc file) was provided, a standard "Open data file" dialog box was displayed (prompting the user to create the data file in the Application folder).

In 4D v15, a new step has been added to the opening sequence, allowing developers to take advantage of the new default data folder feature (see above). In step 2, the application is now opened without using any standard "Open data file" dialog box and developers can execute suitable custom code.

The new opening sequence for launching a merged application is:

  1. 4D tries to open the last data file opened. 
  2. If not found, 4D tries to open the data file in a default data folder next to the .4DC file in read-only mode (new in 4D v15).
  3. If not found, 4D tries to open the default data file next to the structure file with the same name.
  4. If not found, 4D displays the standard "Open data file" dialog box.

 
PROPERTIES 

Product: 4D
Theme: Design Mode

 
HISTORY 

 
ARTICLE USAGE

4D v15 - Upgrade (standard edition) ( 4D v15)

Inherited from : Default data file in merged applications ( 4D v15)