Using a Coded Lookup Field


A coded lookup field stores one field while displaying another. The Invoice form shows an example of the value of coded lookup fields in its embedded browse. The left-most column of the browse displays the description field from the invoice_items table. This effect is achieved through Field Rules. This is how it was done in the AlphaSports sample database:

  1. Open the Field Rules for the invoice_items table.

  2. Display the Lookup tab the product_id field.

  3. Set Lookup styles to "Table lookup".

  4. Set the Table field to the name of the table that will provide the field to display.

  5. In Linking Field select the field that connects the invoice_items table to the product table. This is the product_id field.

  6. Enter the expression that will order the entries in Display Order field. This is not required, but since the description field will be displayed, it makes sense to sort the entries alphabetically.

  7. If there was a reason not to display all description fields that match product_id fields, you could also have a filter expression in the Filter field.

  8. Enter the linking field from the product (source) table in the first row of the Source column.

  9. Enter the linking field from the invoice_items (destination) table in the first row of the Fill column.

  10. Set Display to "No".

  11. Enter the display field from the product (source) table in the second row of the Source column.

  12. Since you are not saving the description field in the invoice_items table, there is no entry in the Fill column.

  13. Set Display to "Yes".

  14. Check the Display as Drop-down list box check box.


See Also