In Notes/Domino, fields are used to enter, modify, and display data stored in items. (Item is the technical name for a discrete data element stored in a Notes document.) Fields can be used in forms, subforms, and layout regions and can be either single-use fields or shared fields. Single-use fields can only be used in the form or subform in which they are created (these are covered in depth in Chapter 4). A Shared field, is a field that can be used in any form or subform in a database. Three key criteria must be specified when creating fields: the field name, the data type of the field, and the field type.
Each field on a form or subform must have a unique name. In addition to using a unique name for each field, you should keep the following points in mind:
Field names cannot exceed 32 characters in length.
Field names cannot contain spaces. You can use underscores (_) instead.
Field names should not begin with a dollar sign ($) because this character is usually reserved for special Notes system fields.
Field names cannot begin with a number (1–9).
The Notes database architecture supports a wide range of data types for fields. They are explained in Table 9.2.
The field type is another key setting involved in adding fields to a form. The Designer supports four field types:
Computed— The value is the result of a formula and is stored in the document. It is recomputed when the document is opened, refreshed, or saved.
Computed for Display— The value is the result of a calculation, but the value is not stored in the document. It is recomputed when the document is created, opened, refreshed, or saved.
Computed When Composed— The value is the result of a calculation, and the value is stored in the document. However, it is calculated only when the document is created, and it's not ever refreshed.
Editable— The value is entered by the user and is stored in the document. A default formula can be used to populate the field when a document is created, and input translations and field-validation formulas can be used to manipulate data when the document is saved and to validate data when it is refreshed.
To create a shared field, follow these steps:
1. | In the Notes Designer client, open the database that will contain your shared field. |
2. | Select Shared Code, Fields, which will display the list of existing shared field. |
3. | Click the New Shared Field button. This opens the Shared Field properties box shown in Figure 9.3. Figure 9.3. The Info tab on the Shared Field properties box enables you to define the basic properties of a field. |
4. | On the Info tab, enter the following information:
|
5. | |
6. | Select the Advanced tab (the third tab) and, if necessary, enter a help description. If the field is set to display multiple values, configure the multi-values options. The Font settings for a field are fairly self-explanatory and are not covered here in detail. |
7. | Select the HTML tab (the fourth tab) to enter HTML-specific attributes for the field, such as class and style. |
8. | Enter any field-related formulas, such as a default value, input translation, or input validation formula. |
9. | Save the shared field. |
Once you have created a shared field, using it is simple. Just follow these steps:
1. | In the Designer client, open the database that contains the form or subform in which you want to use the shared field. |
2. | Open the form or subform. |
3. | Position the cursor to the place on the form or subform where you want the shared field to appear. |
4. | Choose Create, Resource, Insert Shared Field. This opens the Insert Shared Field dialog box. |
5. | Choose one or more of the shared fields displayed and click OK. |
To modify a shared field, follow these steps:
1. | In the Designer client, open the database that will contain your shared field. |
2. | Select Shared Code, Fields, which will display the list of existing shared fields. |
3. | Double-click the field you want to edit. |
4. |
The following is a list of tips to help you in troubleshooting shared fields:
Check the field properties to ensure the field is set to the proper data type.
Ensure that the type of field is set correctly. For example, if the field value should be saved as an item in the document, but it's not, be sure that you have not set the field to Computed for Display.
If you are planning to store multiple values in a field, be sure that the field has the multi-values property enabled.
If the field is of type keywords but you are not getting the correct values in the list, check the formula being used to generate the list.
If the field is computed and the computations are based on other fields in the form, be sure to check the order of the fields. Remember that in Notes, fields are computed from left to right and top to bottom.
18.218.252.81