Preliminaries

Keystone has "native" option menus, of course. But what about when you want to add an option menu for some special form entry? Using the extended schema (eschma) table, it is easy to add numeric and text fields. There is a hack to allow this same mechanism to create option menus. Since Keystone is in beta, this may change before the release, but if you have to have option menus now (I did), read on.

First, you will have to decide where you want to have the option menus. This is because eschema adds the new fields on a per-table basis. You are quite likely to have to add the option menu in more than one place; for example, adding an option menu to the slips table may mean that you want to also add one to the followups table.

Using the Extended Schema (eschema)

To make option menus work, you will need to add several rows to eschema for each option menu. Each option in the option menu corresponds to a row in eschema. At present, the Keystone front-end for eschema (found under `Maint'), has no built-in support for option menus, so it doesn't do some of the validation it could. This is likely to change, but for now you will need to be careful with your data entry.

The columns etable, element, etype, eflags, and elength should all be the same for each option menu choice. The eflags field should include `O' (that's a capital letter "oh" not a zero). The etype column should probably be `C' for character (meaning string); using numeric option menu items may break something; Postgres and MySQL do things differently with converting strings to numbers.

The elabel column contains the string which will be displayed as option menu choices, with one exception. The esequence table indicates the order of the option menu choices. The entry with esequence=0 will be used as the option menu label itself, not as a choice.

At present, the changes have only been tested with the slips table simply because that is where I needed it first. I'll be making sure it works elsewhere, too. If you have a preference for what gets added first, send me email. If you find someplace where the option menu items are showing up as text entries, that's a place I need to work on; let me know about it.


Roland B. Roberts
101 West 15th Street, Apt. 4NN
New York, NY 10011
roberts@panix.com
Last modified: Mon Jan 11 22:16:27 EST 1999