4D v16.3Creating and modifying fields |
||
|
4D v16.3
Creating and modifying fields
Creating and modifying fields
For each table, you need to create the fields that hold the data you want to store and manage. When you create a field, you assign it a field type that describes the kind of information that will be stored in it. 4D uses the field type to perform different kinds of operations on the contents of the field. For example, if a field will contain a date, you will want to create it with a Date field type. Subsequently, 4D can compute date values, such as length of service or qualification for benefits. In addition, 4D can sort records in chronological order using the dates in this field. Field types are described in 4D field types. In addition to the field type, each field in a table can possess various properties. These properties determine conditions for entering, displaying, or modifying data in the fields. They are described in Field properties. After creating a field, you can always later change its type or properties, or even delete it. You can create up to 32,767 fields in a table. You can create a new field using standard creation commands or by copy-paste. To create a field:
A field is then added to the table and 4D selects it. By default, the field is named Field_X where X corresponds to the current field number (if fields have been deleted, this number may not correspond to the actual number of fields in the table, see the "Number of deleted fields" section below). You can also change its names, set its properties, etc. (see the following paragraphs). To create a field using copy-paste:
Note: Indexing properties are not kept when fields are created by copy-paste. You can rename fields at any time; 4D will update the names of the fields wherever they are being used (forms, methods, files). Be careful, if methods were open in the Method editor when the field name is changed, they will need to be closed and reopened in order for the name of the field to be updated. Each field name in a table must be unique. You can rename a field directly in the Structure editor and in the Explorer, or using the Inspector palette. To rename a field directly (Structure editor or Tables Page of the Explorer):
To rename a field using the Inspector palette of the Structure editor:
To find out the rules for naming fields, refer to Rules for naming tables and fields. 4D lets you modify the order in which fields appear in the tables of the Structure editor. Changing the order of fields in tables can, for example, make analysis of the structure easier. Note that reorganizing fields in the Structure editor does not effect their display in the other editors of the application. In fact, 4D always displays the fields in their order of creation (including when the Insert Field command is used) — except in the case of the Explorer, where objects are displayed by alphabetical order. There are two ways to modify the order of the fields:
You can delete fields from your tables. However, this cannot be undone. This operation can be carried out either via the SQL engine of 4D or via the Structure editor. For more information about using SQL statements in 4D, please refer to the 4D SQL Reference manual. To delete one or more fields in the database using the Structure editor:
When a field is deleted, the other fields of the database are not renumbered, so as to avoid endangering the stability of the database. It is therefore possible, for example, to have a table with four fields numbered 1,4, 6 and 8. Note that the numbers of permanently deleted fields are reused when new fields are created subsequently.
|
PROPERTIES
Product: 4D
HISTORY
TAGS UUID ARTICLE USAGE
4D Design Reference ( 4D v16) |