APPLICATION DESIGN


Creating a shared field
You can define a field for use on more than one form. For example, many forms have a creation date field, so you can define this field once and reuse it. When you define a field as a shared field, IBM® Lotus® Domino(TM) Designer displays the field with a wider border than other fields and adds the field name to a list of shared fields available for use in a database. To insert a shared field into another form in the database, select the field name from the list of shared fields.

You can design a field specifically as a shared field, or you can convert a single-use field that is not in a layout region to a shared field.

To create a shared field

1. In the Database Navigator, open Data and double-click Shared Fields.

2. In the Shared Fields section, click the button "New Shared Field."

3. Enter a name for the shared field.

4. Assign a field type and choose Editable or a computed option, if applicable.

5. Close the properties box.

6. Close and save the shared field.

To insert a shared field

1. Open a form and move the cursor to where you want the field to appear.

2. Choose Create - Resource - Insert Shared Field. The Insert Shared Field dialog box appears.

3. Select the shared field you want to use from the current database and click OK.


4. (Optional) Type a text label next to or above the field.

5. (Optional) Highlight the label and choose Text - Text Properties to change the text style.

To rename a shared field

Renaming a shared field affects all forms that use the field, as well as any documents created with the form. After renaming a shared field, edit each form that uses the shared field. Delete the old shared field, and insert the new shared field. Also revise all formulas that refer to the former field name. If you already used the form to create documents, create and run an agent to reassign field data to the new field name and to computed fields.

To delete a shared field

To delete a shared field, you select the shared field from the list of shared fields and choose Edit - Delete.

When you delete a shared field from a form, you delete only the field reference from the form. Because other forms may use the shared field definition, its definition remains in the database. Unless you delete the field data with the @DeleteField function, the data from deleted shared fields can be displayed again by adding a field of the same name or re-inserting the shared field.

When users open a document that refers to a deleted shared field, they see this message:

Cannot locate field definition for Field: <field name>.

When users click OK, they see the contents of the shared field as non-editable text.

To prevent this message, modify each form to convert the old shared field to a single-use field (by cutting it and pasting it back on the form). The field definition is stored within each form, rather than in a central location, and documents can be displayed as they were when they referred to a shared field definition.

To convert a single-use field to a shared field

1. Open the form.

2. Click the field to be shared.

3. Choose Design ­ Share This Field.

To create multiple shared fields for different languages

If you have a multilingual database, you may want to create multiple copies of a shared field and target each one for a different language. For example, you may want the help text for a shared field to be different for different languages.

To create multiple shared fields for use in a multilingual database:

1. Make sure that the database containing the shared field is set up to be a multilingual database (File - Database - Properties. At the Design tab, check "Multilingual database.")

2. In Designer, click Shared Code - Fields to display the list of shared fields.

3. Create the shared field you want to use in the multilingual database.

4. Depending on the number of languages, create multiple copies of this shared field by copying and pasting the shared field. If the original field is named info, copies of the field are named info_1, info_2 and so on.

5. For each copy of the shared field:

6. Repeat the previous step for each copy of the shared field and specify the appropriate language.

See Also