Display an Icon in a View

In addition to displaying data, columns can also be used to display a small visual icon. This is a built-in feature and is typically used to signify some state associated with a particular document. Icons could be used to indicate the status of a document (such as a green, yellow, or red stoplight icon) or whether the document has an attachment (such as a Word document, spreadsheet, or sound file). This enables users to quickly gather information pertinent to a document.

How It Works

To display a view icon, two items must be setthe column property and the column formula. To display an icon for any given column, you must select Display values as icons in the properties dialog. Additionally, the column formula must equate to a corresponding icon value. There are 180 default icons provided with release 7 that can be displayed in a view column (see Figure 15.2). These icons are automatically included with Lotus Notes and cannot be changed.

Figure 15.2. All default view icons displayed by reference number

 

Implementation

This example illustrates how to set the view icon for a document attachment. The unique icon number is computed based on the extension of the attached file. To implement this solution, perform the following steps.

Step 1.

Create a view.

 

   

Step 2.

Create a column. In the column properties dialog, set the column width to 1 and enable the Display values as icons configuration option (see Figure 15.3). Close the properties dialog after these values have been set.

 

Figure 15.3. "Display values as icons" column property setting

 

Step 3.

Set the column display type to Formula and insert the following in the Programmer's pane for the column.

 

REM {Display Lotus Database icon for NSF files}; REM {Display Photo Icon for GIF files}; REM {Display PowerPoint icon for PPT files}; REM {Display Sound icon for WAV and MP3 files}; REM {Display Lotus 123 icon for WK3 or WK4 files}; REM {Display MS Word icon for DOC files}; REM {Display MS Excel icon for XLS files}; REM {Display File Icon for TXT files}; @If (@Attachments = 1; @If (@Contains(@UpperCase (@AttachmentNames); ".NSF"); 4; @Contains(@UpperCase (@AttachmentNames); ".GIF"); 13; @Contains(@UpperCase (@AttachmentNames); ".PPT"); 14; @Contains(@UpperCase (@AttachmentNames); ".WAV"); 15; @Contains(@UpperCase (@AttachmentNames); ".MP3"); 15; @Contains(@UpperCase (@AttachmentNames); ".TXT"); 21; @Contains(@UpperCase (@AttachmentNames); ".WK3"); 135; @Contains(@UpperCase (@AttachmentNames); ".WK4"); 135; @Contains(@UpperCase (@AttachmentNames); ".XLS"); 141; @Contains(@UpperCase (@AttachmentNames); ".DOC"); 142; 5); @Attachments > 1; 5; 0)

Figure 15.4 shows an example view with a column icon that indicates attachment type.

Figure 15.4. Column icon indicating attachment type

Категории