KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Default Data File Read Only by Nature
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: December 18, 2019

Developers have the option of using a default data file with their built applications. The default data file is automatically opened in read-only mode so it is a great way of providing read-only data in demo applications or as a way to provide default data if there isn't another data file already that can be used.

The documentation states "If a default data file" is detected, it is automatically opened silently in read-only mode by 4D". However, this statement leaves some ambiguity to whether the file properties are changed to be read-only or if it is possible to programmatically change it to have read/write access after loading it into the application.

The properties of the default data file shows it has read/write access. Therefore it is set to read-only mode when it is loaded into the database.



Placing the command, READ WRITE, on the database startup method does not programmatically allow the default data file to have write access either.

Thus, the default data file is opened in read-only mode by nature and it cannot be changed to have read/write access.

To allow users to edit the data of a built application with a default data file in place, you'll want to use OPEN/CREATE DATA FILE to bypass the default data file and open/create a file with read-write access. The default data file is strictly meant to provide users with non-editable data for demos or as examples.