Creating, Modifying, and Troubleshooting Shared Fields

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.

Naming Fields

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).

  • Field names cannot contain the ampersand symbol (&).

Field Data Types

The Notes database architecture supports a wide range of data types for fields. They are explained in Table 9.2.

Table 9.2. Notes Data Types
TypeDescription
TextA field that stores up to 15KB of textual data, can be displayed in views, and has no fixed field length.
Date/TimeDate/time fields store and display time and date information in any number of formats, the default being MM/DD/YY HH:MM:SS (internally, Domino stores times in seconds). Valid dates range from 1/1/0001 through 12/31/9999. Entering a two-digit year between 00 and 49 assumes the century starts in the year 2000. Entering two-digit years between 50 and 99 assumes the century starts in the year 1900. You can force users to enter a four-digit year in the field by selecting Require User to Enter Four Digit Years in the On Input field in the Field properties box. If you want to display a calendar control for users, select Calendar/Time Control.
TimezoneTimezone fields display a drop-down list of all available time zones.
NumberNumber fields are used to store numeric data, including numerals 0 through 9, the plus (+) and minus (–) signs, decimal points, and scientific notation. Number fields can be formatted in one of four ways, as explained in the following list:
  • Decimal— Stores and displays numbers with a fixed number of decimal places specified by the developer. A number field can store up to eight nonzero decimal digits without loss of precision.

  • Percent— Stores and displays numeric values as a percentage.

  • Scientific— Stores and displays numeric values using exponential notation.

  • Currency— Stores and displays numeric values with the currency symbol specified by the developer. The default format is the American dollar sign ($).

Blank number fields are stored as an empty string (“”). To make a number field always store a numeric value, use a default formula of 0.
Dialog listEnables users to select the correct value(s) from a list of acceptable choices. The developer can determine whether the list should be mutually exclusive. The user can press Enter or click the Entry Helper button (the little arrow) to see all the choices at once, press the spacebar to display choices one at a time, or type a letter to display the first choice beginning with that letter. Keep in mind that you cannot use a dialog list in a layout region.
Check boxEnables users to select the correct value(s) from a list of acceptable choices that are not mutually exclusive. Each choice in the list is displayed with a box users click to select.
Radio buttonEnables users to select the correct value from a list of acceptable choices that are mutually exclusive. Each choice is displayed with a button that users click to select.
List boxEnables users to select the correct value(s) from a scrolling, fixed-size list of acceptable choices. The developer can determine whether the list should be mutually exclusive.
Combo boxEnables users to select the correct value from a drop-down list of mutually exclusive acceptable choices.
Rich textRich Text fields can be used to store large amounts of text or formatted text, and they can be used for embedding or attaching objects. There is no practical size restriction (1GB) on the data placed in the field, as long as the database and disk drive can store the data. Rich Text fields can be used anywhere except in a layout region, and their contents cannot be displayed in a view.
Rich text liteRich Text lite fields are not as open-ended as regular Rich Text fields. They have a drop-down list that allows you to specify the type of data to put in the field. Any attempt to insert or paste an element not listed displays an error message. This field type is new to Domino 6.
AuthorsAuthors fields enable users with Author access to edit documents if they are named in the authors field. It is important to remember that authors fields do not override the ACL but rather refine it.
NamesNames fields can be used to display user and/or server names.
ReadersReaders fields can be used to limit access to specific documents by explicitly listing the users/groups who can read documents. Like authors fields, readers fields refine the ACL; they do not override it. If no readers fields exist in a document, anyone with access to the database can read the document.
PasswordA password field is a special type of text field that helps to maintain privacy by displaying each character entered as an asterisk on the screen. Remember that the contents of a password field are not secure and are visible in the Document properties box from the Notes client. This type of field is new to R6.
FormulaFormula fields have a special purpose; they are used to populate a subscription list, which works in conjunction with the Subscription feature in the Headlines.nsf database.
ColorColor fields display a color picker that allows the user to select a color and then returns an RGB value.

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.

Creating Shared Fields

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:

  • Enter a name for the field in the Name field (keep the naming conventions mentioned previously in mind).

  • Select the data type of the field (defined in Table 9.3).

  • Select the type of the field: Editable, Computed When Composed, Computed for Display, or Computed.

  • If the field can store multiple values, select the Allow Multiple Values check box.

  • If the field is computed and you would like its value to be computed after the form's validation formula has fired, click the Compute After Validation check box.

  • Choose the type of appearance the field should have—either Notes Style or Native OS Style. If you select Native OS Style, be sure to set the height and width properties.

  • Set the field's tab order and, if you want the field to get the default focus (meaning the cursor is positioned in this field first), click the Give Field Initial (Default) Focus check box.

5.
Select the Control tab (the second tab) to choose the display options for the field. The choices presented on this tab vary widely, depending on the type of field you have elected to create. Be sure to check the settings for the field you are creating.

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.

Using a 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.

Modifying Shared Fields

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.
Follow the steps outlined in the earlier section “Creating Shared Fields.”

Troubleshooting Shared Fields

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.252.81