4D v13.4

Creating a new application

Home

 
4D v13.4
Creating a new application

Creating a new application  


 

 

You can create a database using a template already containing elements (tables, fields, etc.) that you can simply adapt to your own needs. You can also create a blank database. Finally, you can create a database from a structure definition that has previously been exported. 

You create databases the same way regardless of whether it is done from the 4D application or from the 4D Server application.

4D database templates are directly operational. Each template includes an interface, tables, fields, forms, methods, etc., that can serve as prototypes for custom developments. Being able to create databases from templates also allows novice users to discover the potential of 4D.

To create a database from a template:

  1. Choose New > Database From Template... in the File menu or in the menu associated with the “New” button of the 4D tool bar.
    The dialog box for choosing the template appears:

    Note: Database templates are stored in a folder named “4D Modèles” or “4D Templates”. This folder must be placed at the same level as the .exe file of the 4D application (under Windows) or the package (under Mac OS). If this folder is missing, a blank window appears. 
  2. Select a template from the themes provided and click on Create Database...
    A standard Save As dialog box appears so that you can choose the name and location of the 4D database:
  3. Enter the name of your database and click Save.
    You can choose any file name allowed by your operating system.

When you validate the dialog box, 4D closes the current database (if any), creates a folder at the location indicated (the name of the folder is the database name) and puts all the files needed for proper operation of the database into it. For more information about the architecture of 4D databases, refer to Database Architecture. The splash screen of the Application mode of the database then appears. You can begin using the database, switch to Design mode (via the Mode menu), add fields, tables, etc.

You can create a blank database, i.e. that does not contain any tables, fields or forms. Its the equivalent of a blank sheet for databases. 

To create a blank database:

  1. Choose New > Database... from the File menu or from the menu associated with the “New” button in the 4D tool bar. You can also click directly on the “New” button of the tool bar.
    A standard Save as dialog box appears so that you can choose the name and location of the 4D database:
  2. Enter the name of your database and click Save.
    You can choose any file name allowed by your operating system. Warning: if your database is intended to work on other systems, you must take the specific restrictions for each of them into account. For example, "backslash" (\) characters are accepted under OS X but they are not allowed under Windows.

When you validate the dialog box, 4D closes the current database (if any), creates a folder at the location indicated (the name of the folder is the database name) and puts all the files needed for proper operation of the database into it. For more information about the architecture of 4D databases, refer to Database Architecture

The 4D application window is then displayed with the Explorer in the foreground. You can then, for example, create project forms or display the Structure editor and add tables, fields, etc.

Structure definitions that are exported in XML format can be used to create new identical databases on the fly. In this case, the structure definition can be considered as a structure template, which can be duplicated at leisure. For more information, refer to Exporting and importing structure definitions

An XML structure definition can be used as is or can be modified beforehand via an XML editor. This means that the use of any type of mechanism used to generate structures by programming can be considered.  

Furthermore, since the internal format of 4D structure definition XML files is public (see Format of a 4D structure definition), it is possible to build this type of file from other database environments or any design application in order to generate 4D databases automatically. 

To create a database from a structure definition:

  1. Select New > Database From Structure Definition... from the File menu of 4D or from the menu associated with the “New” button in the 4D tool bar.
    A standard Open document dialog box appears so that you can specify the definition file to be opened. You must select an XML format file that respects the “grammar” of 4D structure definitions (the program validates the file via the DTD). 
  2. Select a structure definition XML file then click OK.
    4D displays a dialog box that can be used to choose the name and location of the database to be created.
  3. Choose the name and location of the database to be created then click on Save.
If the XML file is valid, 4D closes the current database (if any) and creates a new structure based on the structure definition. A folder is created at the location indicated (the name of the folder is the database name) that contains all the files needed for proper operation of the new database. The Explorer window then appears.

 
PROPERTIES 

Product: 4D
Theme: Managing 4D files