Derived Fields
When you have indices defined on your lookup table you can also use the data in the index itself to populate choice fields.
Consider a choice field for selecting a product:
CartLine:
product:
type: choice
constraint: one
widget: dropdown
options:
- MUG-001
- MUG-002
- MUG-003
- CLAY-2K
- CLAY-10K
quantity:
type: numeric
min: 1
max: 100
step: 1
The same could be expressed like this assuming a lookup table products
from the previous chapter exists:
CartLine:
product:
type: choice
constraint: one
widget: dropdown
options: derive.products.unique.code
quantity:
type: numeric
min: 1
max: 100
step: 1