4D v16.3Data file management in final applications |
||
|
4D v16.3
Data file management in final applications
Data file management in final applications
When a user launches a merged application or an update (single-user or client-server applications), 4D tries to select a valid data file. Several locations are examined by the application successively. The opening sequence for launching a merged application is:
When the Use new architecture for application deployments compatibility option is checked (see Compatibility page), any standalone or server applications built with 4D stores the path of the last data file opened in the application's user preferences folder. Compatibility note: In previous versions of the program, this information was stored in the structure file. The location of the application's user preferences folder corresponds to the path returned by the following statement: userPrefs:=Get 4D folder(Active 4D Folder) The data file path is stored in a dedicated file, named lastDataPath.xml.
Thanks to this architecture, when you provide an update of your application, the local user data file (last data file used) is opened automatically at first launch. This mechanism is usually suitable for standard deployments. However for specific needs, for example if you duplicate your merged applications, you might want to change the way that the data file is linked to the application. For more information, please refer to the next section "Configuring the data linking mode". With your compiled applications, 4D automatically uses the last data file opened. By default, when the new architecture is activated (starting with 4D v15 R4, see section above), the path of the data file is stored in the application's user preferences folder and is linked to the application name. This may be unsuitable if you want to duplicate a merged application intended to use different data files. Duplicated applications actually share the application's user preferences folder and thus, always use the same data file -- even if the data file is renamed, because the last file used for the application is opened. 4D therefore lets you link the data file path to the application path. In this case, the data file will be linked using a specific path and will not just be the last file opened. Duplication when data linked by application name: Duplication when data linked by application path:
You can select the data linking mode during the build application process. You can either:
4D allows you to define a default data file file" at the application building stage. When the application is launched for the first time, if no local data file is found (see sequence described above), the default data file is automatically opened silently in read-only mode by 4D. This gives you 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:
To define and use a default data file:
The following graphic illustrates this 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.
|
PROPERTIES
Product: 4D
HISTORY
Created: 4D v15 ARTICLE USAGE
4D Design Reference ( 4D v16) |