Using Lists as Lookup Tables
It can be useful to have lookup tables to convert or transform informaiton from one thing to another. For example, you might have states stored by their two-letter abbreviations in the database, but when the data is published you want to spell out the full name of each state. With CatBase (Version 7.1 or later) you can use Lists to manage this very easily.
- First set up your list:
- Go to the Admin menu and expand the Lists topic on the left.
- Select an existing List, or click New List to create a new one.
- Add new List items, if necessary, by clicking on the Add an Item button at the bottom of the list.
- When an item has been added to the list, double-click in the Description column for that item.
- Enter the alternative text for that item. For example, if the item text is "FL" you would enter "Florida" in the Description cell.
- Add all the required options to the list.
- Attach the list to the appropriate field:
- Select the Database Setup topic under the Admin menu.
- Select the table in which the appropriate field resides.
- Double-click the field that you want to attach the List to (eg State in the example used here)
- Select the Choice List option in the Field Properties dialogue.
- Select the list from the pop-up menu that appears next to the checkbox.
- Save the field changes.
- Place the field on your data entry form using the Form Design Wizard. It will appear as a popup choice list.
- Now you just need to tell CatBase to publish the Description instead of the item text:
- In your Publishing Stylesheet, add an Element to the Paragraph in which you want the list data to be published.
- Select the Elment type: Field.
- Select the appropriate field (eg State in this example)
- Click on the Preferences tab in the Element dialogue.
- Select the Use List Item Description checkbox in the Lists area.
- Save it.
That's it! When the data is published using that Publishing Stylesheet, the item descriptions will be published instead of the item text.