Fields editor

Previous Top Next

By default for each physical field at opening a data set the object of TField type is created and all fields are accessible in a data set. These fields are dynamic. For creation of static fields the special fields editor is used. In case even one field of a data set is static the dynamic fields will not be created. Thus, in a data set static fields will be accessible only, and all others are considered as absent fields. To define or to cancel list of static fields is possible by means of the fields editor on a development stage of the user form.

For start of fields editor it is necessary to click the right mouse button on the Table component and to choose Fields editor item from the pop-up contextual menu. For move on the fields 4 buttons of the editor or the contextual menu (becomes active by pressing of the right mouse button on the list) are used. The most part of the editor is occupied by the list of static fields, thus fields are listed in order of their creation, this order can differ from the order of fields in the table of a DB.

Originally the list of static fields is empty. By means of fields editor the developer can do:

- To create a new static field;

- To delete a static field;

- To change the order of static fields;

- To create a new field.

For addition of a static field it is necessary to call the contextual menu of fields editor and to choose Add new field item, therefore there will appear a dialog window of addition of new fields. In Available fields list (accessible fields) of window all those fields of a data set, which yet are not static are contained. After a choice of one or several fields and pressing of OK button these fields are added into list of static fields of a data set.

For creation of a new field it is necessary to choose in the contextual menu of the fields editor Add new field item. As a result there will be a dialog window of creation of a new static field.

For specifying the common properties the group of operating elements Field Properties is used. In the Name field a name of a field is set. The type should be set necessarily for any field, necessity of specifying of the field size depends on type.

The field type (Lookup Fields) - a field of a choice, which value can be chosen from the list formed on the basis of criteria and rules.

In Lookup Definition group for a field of a choice such parameters as a data set and fields of link are set, and also fields for formation of the list of a choice and result may be set.

Lookup Fields gives an opportunity to choose one value from the offered list and automatically to write down the information into the specified field of modified record. With Lookup Fields the list filled by values of the specified field from the second table is linked. Both tables contact the help of a corresponding field.

Let's consider an example of use of Lookup Fields. In the project of a DB "Account and registration of landownership" (LandUse.dbp) is conducted the table "Right of physical persons" (Rightf.dbf) into which the information (in brackets are shown the name of table fields) is brought in:

- Unique number of record (R_NUMB);

- Cadastral number of the ground area (R_CADNUM);

- Unique code of the right (R_PRAVO).

Data about each right are stored in other table "Classifier of the rights" (Spravr.dbf), in which are entered:

- Unique code of the right (S_NUMB);

- Name of a right kind (S_NAME).

Let's generate Lookup Fields, which contains the list of the rights kinds from which the user chooses one of names. After a choice of the right kind into R_PRAVO table field the corresponding code is automatically brought in.

For creation of a field of a choice it is necessary to execute actions:

1. In Base Administrator in the User forms bookmark to press Add button. Form constructor becomes active.

2. To create a new form (Form/new command, or choose the button: Create new form).

3. To place onto the form Table1 component, which provides access to records of the table of "Rights of physical persons" (Rightf.dbf).

4. To place onto the form Table2 component, which provides access to records of the table " Classifier of the rights " (Spravr.dbf).

5. To place onto the form the Grid component to display data of Table1.

6. With help of Fields editor to add into the list a static field R_PRAVO (Table1).

 

 

    7. To create new field R_PRAVONAME (Table1).

 

The window of creating a field of a choice is shown in the figure.

_engbm5678

 

The field of a choice is named R_PRAVONAME and belongs to data set Table1. For formation of the list of a choice the field S_NAME of a data set Table 2 is used. Link between two data sets Table1 and Table2 is carried out through their fields of a code of right R_PRAVO and S_NUMB, accordingly.

Use of a field of a choice consists that the user chooses value from a field of result R_PRAVONAME containing the list, which is constructed on the basis of S_NAME field values. After a choice of value for field R_PRAVONAME from S_NUMB link's field the corresponding value into R_PRAVO field is automatically brought. Thus, S_NAME field containing the list is used for a choice, and a field of link R_PRAVO - for placing the values into it.

In the figure the example of using a field of a choice is shown. In the top part of the form the table of "Right of physical persons" is displayed, and in the bottom part - the table of data which is shown for obviousness. On practice the connected data set usually is not shown. At a choice of values from the list in a field of a choice for the connected data set the current index is placed onto record from which the value has been chosen.