4D v14.3

Display of fields in list boxes

Home

 
4D v14.3
Display of fields in list boxes

Display of fields in list boxes  


 

 

You can associate list box columns with fields from the master table and/or fields from different tables. For more information about the master table, refer to List box specific properties.

However, in all cases, the contents of the list box will be based on the current selection (or a named selection) of the master table of the list box:

  • If you only use fields from the master table, the contents of the list box rows will simply be modelled on those of the master table selection.
  • If you use fields that do not belong to the master table, these “foreign” tables must be related to the master table by a Many-to-One relation, otherwise the “foreign” fields will be displayed empty. Automatic relations will be activated for each record of the master table selection and the list box will display the corresponding data in the related fields.
    If you use manual relations, you must program the activation of the relations in order to display the data in the list box.

If an inconsistency in the definition of the list box causes columns to be displayed empty, an error message will appear in the Application mode in each incorrect column. 

We will use an example to explain the different cases. 

Given a database with two tables: [Companies] and [Employees].

  • The current selection for the [Companies] table is the following:
    Company Name
    Big Encyclopedias
    Tiny Computers
    Boring Travel Company
  • The current selection for the [Employees] table is the following:
    First NameLast NameCompany Name
    CarlaPackardBoring Travel Company
    AndrewBlackTiny Computers
    VincentLaughterBoring Travel Company
    OliverDawsonBoring Travel Company
    SylviaFairviewTiny Computers
    RobertLanzelBig Encyclopedias
    ArnoldSchmittBoring Travel Company
    ElizabethJonesBig Encyclopedias
    YolandaCourtTiny Computers
    PascalPrattTiny Computers

The [Companies]Name field is associated with the first column of a list box. The [Employees]First Name and [Employees]Last Name fields are associated with the next two columns. The data source of the list box is the current selection.

  • Case 1: The two tables are related using an automatic relation

    1) The master table of the list box is [Employees]. The list box displays the current selection of the [Employees] table and activates the automatic relation to display the name of the company for each employee:

    2) The master table chosen for the list box is [Companies]. The list box displays the current selection of the [Companies] table. Since there are only three records in this selection, only three rows are displayed in the list box. The columns for the [Employees]First Name and [Employees]Last Name fields are empty:
  • Case 2: The two tables are not related (or they are related using a manual relation).

    1) The master table of the list box is [Employees]. The list box displays the current selection of the [Employees] table. The column of the [Companies]Name field is empty:

    2) The master table chosen for the list box is [Companies]. The list box displays the current selection of the [Companies] table. Since there are only three records in this selection, only three rows are displayed in the list box. The columns for the [Employees]First Name and [Employees]Last Name fields are empty:

Naturally, you can manage the selections of different tables by programming and in this way display columns associated with fields that do not belong to the master table.

 
PROPERTIES 

Product: 4D
Theme: List boxes

 
ARTICLE USAGE

4D Design Reference ( 4D v14 R2)
4D Design Reference ( 4D v14 R3)
4D Design Reference ( 4D v14.3)
4D Design Reference ( 4D v14 R4)

Inherited from : Display of fields in list boxes ( 4D v12.4)