Examples: Generating category names

The following examples illustrate how to generate category names in a categorized view.

Displaying the names of months

This formula is useful for a categorizing column that displays the name of each month as a category name. Dates need to be converted to a text value to be displayed in a view.

m :=@Month(@Created);
@If(m = 1; "January"; m = 2; "February"; m = 3; "March";m = 4; "April";m = 5; "May"; m = 6; "June";m = 7; "July";m = 8; "August";m = 9; "September"; m = 10; "October"; m = 11; "November"; m = 12; "December"; "")

To sort these in proper order, add a hidden column to the left of this column that sorts documents in ascending order with the formula

@Month(@Created);

Adding subcategories to an All by Category view

In your Furniture Catalog database, you want to add subcategories, indented under the main categories, to make documents easier to find in the All by Category view. Subcategories are indented under main categories automatically in a categorized column. You can have 32 levels of subcategories.

The Categories field of the Furniture Description form is an editable choice list field with the following entries:

Bedroom
Kitchen
Living Room

To add subcategories, rewrite the choice list choices as follows, update existing documents, and refresh the view. A backslash ( \ ) after a main entry denotes the subcategory name.

Bedroom\Beds
Bedroom\Dressers
Kitchen\Tables
Kitchen\Chairs
Living Room\Sofas
Living Room\Tables

Recategorize the documents that already exist to assign them to one of the subcategories. You can do this manually by choosing Actions - Categorize, and then typing the full subcategory specification (Bedroom\Beds) into the Categories dialog box. If there are many documents, create agents that set the new values for the Categories field of each document.

Press SHIFT+F9 to rebuild the view index so documents display with their new subcategory names.