4D v16.3

Using references in static text

Home

 
4D v16.3
Using references in static text

Using references in static text  


 

 

You can use the current values of fields and variables as well as table and field names in your static labels in order to set up dynamic interfaces. 

You can insert these dynamic labels into the following types of static text:

Note: Dynamic references based on XLIFF (XML) architecture, particularly suitable for interface translation, can also be used in these labels, as well as menu and button labels. For more information, refer to Appendix C: XLIFF architecture.

In the Form editor, you can choose the version of the labels to display by selecting either Show Name or Show Resource in the Object menu.

You can embed field names or variable names in static text areas. When the text area is displayed or printed, the values of the fields or variables from the current record are substituted. Use embedded fields and variables to create mail-merge documents and in report headers and footers.

You can embed the field or variable name by inserting it between the < > symbols.

  • You can use a field from any table in the database. Fields from the current table do not have to specify the table name; they can be entered like this: <FieldName>. Fields from other tables must specify the table name; they are entered like this: <[TableName] FieldName>. When the form is printed, the information from the field for each record replaces the <FieldName> element in the text area.
  • A variable must be inserted like this: <VariableName>. Make sure that the value of each variable is assigned by an object or form method.

You can specify how an embedded field or variable is displayed by inserting a semicolon followed by a display format directly after the field or variable name. For example, the  embedded variable <vTotal;$###,##0.00> calculates the amount of the person’s total pay for the month and displays it in a dollar format. For more information about display formats, refer to Display formats.

For an example of mail-merge documents using embedded fields and variables, refer to Creating mail-merge documents.

You can use a pop-up menu to insert a field reference into a block of static text: 

  1. Select the text tool .
  2. Click in the static text area while holding down the following keys:
    • Alt (Windows) or Option (Mac OS) to display a pop-up menu containing fields from the table (this menu only works with table forms).
    • Alt+Shift (Windows) or Option+Shift (Mac OS) displays a hierarchical menu of tables and fields in the database.
    4D places <FieldName> or <[TableName]FieldName> in the text area at the insertion point.

You can insert dynamic table and field names into your forms (as static text). When you place dynamic table or field names in your forms, they are automatically updated throughout your database when you modify the table or field name in the Structure editor or when the 4D SET TABLE TITLES and SET FIELD TITLES commands are called. This feature is particularly useful for translating the structure of the application that is visible to the user.

  • To insert a dynamic table name: <?[TableName]> or <?[2]> (the table’s creation order number, meaning the second table created).
  • To insert a dynamic field name: <?[TableName]FieldName> or <?[2]3> (the table’s and field’s creation order number), or even <?3> (the field’s creation order number) for a field of the current table.

Remember that since field and table numbers correspond to their creation order, it is possible to add or rename tables and fields without affecting the system of dynamic references.

Note: Dynamic field names are available as an option on the Options page of the Form Wizard  (refer to Creating a form using the Form Wizard).



See also 

Using references for menu titles

 
PROPERTIES 

Product: 4D
Theme: Building forms

 
HISTORY 

 
TAGS 

structure virtuelle

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)