How do I restrict the list of values in a reference column based on another column?

For example, there are three tables:

Products, which contains records for ham and cheese and their nutritional value per 100g

  • name
  • proteins
  • etc.

Units, which contains the units for each product and their weight:

  • product (reference to Products)
  • name (slice, package)
  • weight

It has a record for a slice of ham and a slice of cheese with different weights

Meals, which contains the amounts actually consumed

  • person
  • date
  • meal (breakfast, lunch, dinner)
  • product (reference to Products)
  • unit (reference to Units)
  • amount
  • a bunch of formula columns

The idea is that the user can select the product and then select the unit of measure appropriate for that product. So no slices of eggs or the slice of cheese for the ham.

Right now I use a formula column that goes “Ham, slice” in the Units table to merge two selection steps into one, but I wonder if that the only possible approach.

2 Likes