Allowing users to set colors in a view

About this task

Domino® Designer allows you to set the color for a column programmatically to visually differentiate documents in a view. You can use this functionality to provide users with the means to set the color for documents in a view. This feature can be extended to allow users to determine the colors for a column by means of a generic profile -- a particular type of form -- to set values in a database. For example, in the Domino® Release 6 mail template (mail6.ntf) you can choose Tools -- Preferences, click the Colors tab and associate colors with different senders to customize how mail displays in your Inbox.

Note: Because it relies on a generic, rather than a user-specific profile form, the feature is only useful for a database with only one user, such as a mail database or a personal journal. You cannot use a personal profile document to let users personalize their view column colors in a shared view. That's because when you use @Username in a view column, it returns the server's username, not the name of the user who's opening the view.
Note: To have a different set of colors for each user, you must use a Shared, Desktop Private on First Use view. Since the view index is created by the user's workstation, it will be able to use their personal profile.

Procedure

Create a profile form in the database that creates one profile for the database. Make sure you create a button, action, or agent that users can run to create the profile document.

Results

For information on creating a profile form, see "Creating a profile form."

  1. Create two fields on the profile form. The first will be a color field that users will use to select a color. The second field will be a formula field set to hold either the value of the color field, or a formula that evaluates to a color. The formula field must have the same name as the programmatic name for the column in the view. For example, if the column's programmatic name is "$3", then the formula field on the profile form must also be "$3". The programmatic name can be text, but user-defined column functionality will not work unless the name begins with an "$."
    Note: If you want the user to be able to set both a text color and a highlight color, you will need two color fields, and the $3 field will need to combine the two colors.

For information on creating a color field, see Color fields. For information on the programmatic name for a column, see Adding programming to columns.

  1. Select the view column you want to make customizable and choose Design - Column properties.
  2. On the Column Info tab, check "Use value as color" and "User defined."
  3. In the field next to "User defined," enter the name of the profile form.
  4. In the programming pane, choose "Formula" as the column value and enter a valid formula, such as @UserName, as the column formula. This formula must return a non-constant, with no special text characters.

Setting the color value in the profile document

About this task

To specify a color for a column, the user must create a profile document without a user name. Since this special type of form cannot be created using the Create menu, you must supply a button, action, or agent the user can use to create the document. When the document is created, the user sees a color picker for the specified column.

For information on creating and editing a profile document, see Profile forms.