When the list of items gets longer, classifying the items becomes helpful. For example, we may want to arrange our shopping list by department in the supermarket.
We will add a 'Category' column to the item table and show how we let the user select for each item a category from a list of categories managed in the system.
Using the 'Table Wizard':
The wizard will update your model with the additional field in all relevant places. If you now save your model and restart the application, you will be able to specify a category for any item you choose:
The wizard has used the mechanism of user defined data types with valid values, and then created a Chooser field using the user defined data type. If you start the application, you will see that the Category field is represented by a drop-down list that lets the user choose one of the 3 values we have specified (Dairy, Drinks or Meat).
Click here to read more on valid values and user defined data types.
Specifying the list of valid values explicitly in the Table Wizard is probably good enough for our simple Shopping List application, but we may want to give the users the ability to manage the list of categories and get the flexibility to decide which categories to include.
This can be achieved by creating a table of categories and specifying that the 'Category' field in 'Items' will refer to this table (i.e. specify the valid values through a foreign key that references the table of categories).
Here are the steps to create and use a table of categories:
Download Model: Stage 7, Final Model (version 2.4.1)
Next: Controlling which items to show
For best results, use the Firefox browser..