4D v16

Tables and fields

Home

 
4D v16
Tables and fields

Tables and fields    


 

 

In this video, we're going to go back over how to create tables and fields.

To keep the data from one session to another or to share them between several users, we can save them, for example, in:

  • a table
  • a text file
  • an XML file
  • or elsewhere in another database.

Let's take the case of saving in a table. We need to:

  • Create the table
  • Create the fields
  • Create at least one entry and display form.

In a previous video, we created a table named "Interventions" using the Explorer. Now we're going to create a table named "Technicians".

  • Click on the "Structure" icon
  • Click on the button in the top left of the structure window.
  • Choose "Table". (A new table is created in the Structure and the Inspector is displayed.)
  • Name the table TECHNICIANS.

There are several ways to add fields; let's use the quickest one:

  • Double-click on the first row of the table.
  • Enter the name of the first field (don't worry about the type, we'll take care of it later).
  • Hit the Enter key and a new field is created.
  • Repeat this procedure for all the fields to create.
  • ID
  • Last name
  • First name
  • Comments
  • And Email

You can go back to each field and choose its type to the right of its name.
You can also double-click on a field to display the Inspector in order to modify its attributes more precisely.

A help tip is displayed when the user moves the mouse over the field. You can use comments to specify any information you consider relevant for understanding development (such as points to consider, field use, etc.)

If you select several fields, the Inspector displays items relating to all of the fields and specifies the number of fields concerned.

To change the type of several fields at once:

  • Select several adjacent fields (by holding Shift) or non-adjacent ones (by holding Ctrl on Windows or Command on Mac)
  • Change type for one of the fields => and the types of all the selected fields are changed.

To move a field:

  • Hold down the Alt key (the cursor becomes a hand)
  • Drag the field to its new position.

There are several solutions for adding tables and fields:

  • Right click (in the structure to add a table or in the table to add a field)
  • File Menu -> New
  • The "New" button in tool bar
  • The Add button in the top left of the Structure
  • By importing data
  • Or retrieval by copying and pasting tables from an existing database.

You'll save time by creating your tables from existing text files (such as .txt, .csv, .dbf, etc.). We recommend that you take a look at what the 4D documentation has to say on this subject (importing data).

We'll cover how we create the Locations table by importing data in another video.

 
 

 
PROPERTIES 

Product: 4D
Theme: Tables and fields

 
HISTORY 

 
ARTICLE USAGE

Self-training ( 4D v16)