Avoid the “Select data file” dialog to show up for a new deployed app

Automatically translated from English

When you deploy an application to your customer, either a merged 4D Server or Single User application, 4D usually opens the “Select data file” dialog. This happens because for an updated solution 4D cannot find the position of the last used data file, as you just replaced the old structure. And for a first time usage, 4D does not know where you would like to create the data file – so it asks for the location.

This dialog, as the very first interaction with your application, might be confusing for the customer. And the verification for the data file happens before the On Startup is executed, before your code has a chance to select another file. To avoid this, 4D v15 introduces a new feature, named Default Data.


This feature is strictly designed for deploying an application. It allows to setup a default data folder, with data file, index file and – if needed – additional files – to be automatically merged with a build application (it is not the data file you use for development and testing, to avoid having modified test data deployed to the end user).

When a merged application, 4D Server or Single User launches, it will check if the last used data file is available. If not, it checks if the build contains a default data folder. If yes, this default data is used in read only mode to open the application.

Now your On Startup method runs, you can detect that it is the default data and decide what to do now. You may present the user your own dialog to select or create a data file, you might have a Preference File in user folder where you stored the path to the data file to switch automatically back, you might automatically create a new one and fill it with data – whatever is best for your business case.

How it works into details

To avoid the “Open Data File” dialog to be presented to an end-user after a product upgrade or at first launch, 4D will try use several default locations upfront, allowing you to deliver an specific data file at a pre-configured location so that you have the means to take the control and display your own open/create data dialog for example.

Steps to perform:

1- The 4D developer creates a “Default Data” folder inside the database package where he puts its data file to be used as default, “Default.4DD”.

2- The build application process integrates the Default Data folder into the merged application.

Note: All files in Default Data folder are copied in the merged application. The default data doesn’t have to be empty. For example, you can use Default Data to make a demonstration of your application.

Default Data folder

The new opening sequence when launching a 4D merged application is the following:

1- 4D tries to open the last data file opened.

2- If not found, 4D tries to open the default data (as explained above) (new)

3- If not found, 4D tries to open the data file next to the structure file with the same name.

4- If not found, 4D displays the standard “Open data file” dialog box.


  • This is at step 2 that the 4D developer can take control and avoid next steps.
  • When 4D uses the default data, it is opened in READ-ONLY.
  • For 4D Developer, the advantage between Step 2 and Step 3 is that the data file is automatically copied during the build app process. Then you don’t need to manually copy it in the package so there is no risk to forget.
    Another advantage: for Mac OS signed application, if you manually add the data file, you will break the signature. Then, you’ll have to sign again your application without 4D assistance. Using the default data mechanism avoid this.


For more information, please read this article in the documentation.

Vanessa Talbot

• Product Owner •

Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.

Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.