Creating a shared field

About this task

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, Domino® 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

Procedure

  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

Procedure

  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.

    To select a shared field from another database, click the Database pull-down list, highlight a database, select a shared field in that database, and click OK.

  4. Optional: Type a text label before the field.
  5. Optional: Highlight the label and choose Text - Text Properties to change the text style.

To rename a shared field

Procedure

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

About this task

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

Procedure

  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

About this task

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:

Procedure

  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:
    • On the Shared Field Info tab of the Shared Field Properties box, set the name to be the same as the name of the original shared field. (Note that Shared fields do not have aliases.)
    • Make the necessary changes to the shared field. For example, if the selected language for that copy of the shared field is to be French, you may want to enter a help description that is in French (Advanced tab of the Shared Field Properties box).
    • Close the Shared Field Properties box.
    • Save and close the shared field.
    • Select the shared field just edited and choose Design - Design Properties. The Design Properties box appears.
    • On the Design tab, select a language for that version of the shared field. Depending on the language you choose, you may also need to select a region for the selected language.
  6. Repeat the previous step for each copy of the shared field and specify the appropriate language.