DataCaptionFields Property

Sets the fields that appear to the left of the caption on forms or pages that display the contents of this table.

  • Forms

  • Pages

  • Tables

Card Forms

Card forms and pages display one record at a time. For these objects, the value of the underlying table's DataCaptionFields property is used; the value of this property on the form or page is ignored. If the DataCaptionFields property is not defined on the table, the primary key is used.

Tabular Forms

Tabular forms and pages show multiple records at a time. The following data caption rules are applied:

  • A data caption is only displayed if a filter containing the fields defined in the DataCaptionFields property for the form or page evaluate to one value. In this case, two situations are possible:

    • There is a table relation (as defined by the TableRelation Property) on one or more of the fields. In this case, the DataCaptionFields from the underlying table are used. If this table does not have a value for the DataCaptionFields property, the primary key for that table is used.

    • There is no table relation. In this case, the (single) value that results from evaluating the filter is used directly.

A form is considered a tabular form when the TableBoxID Property of the form is not blank.

Example of DataCaptionFields Use

The following is an example of how the DataCaptionFields property is used. The Customer Card form (21) is based on the Customer table (18). Using the Customer menu on this form, users can open other forms, including the Customer Ledger Entry form (25) and the Customer List form (22). The Customer List form is invoked using the Lookup Table menu item.

In the Customer table, the DataCaptionFields property is set to No., Name. On the Customer Ledger Entry form, the DataCaptionFields property is set to Customer No.. When the Customer Ledger Entry form (25) is opened from the Customer Card form (21), a filter is set on Customer No. field of the Customer Ledger Entries table, selecting only those entries related to the currently displayed customer on the Customer Card. This relationship is accomplished by setting the RunFormLink property of the menu item that invokes the Customer Ledger Entry form to Customer No.=FIELD(No.).

If you view the Customer Ledger Entry form with a filter applied, the customer name and number appear to the left of the caption on the Customer Ledger Entry form. If you remove the filter, the caption disappears. Next, open the Customer List form from the Customer menu on the Customer Card. No caption is displayed because all customers are shown and no filter is set. Set a filter on the Customer No. field to restrict the form to show only one customer. No caption appears because no DataCaptionFields are defined for the Customer List form.

This example does not cover all the possible situations, but should provide some idea about how this property is used. The important point is that the DataCaptionFields property on a form does not directly put any caption on the form, but only works when used with appropriate settings of DataCaptionFields at the table level.

Community Additions