Customizing the metamodel > Specifying key and keyed by properties > Examples of key and keyed by > Creating a list of a keyed definition
  
Creating a list of a keyed definition
(Following on from the example in A third definition with two key properties.)
For every “Car Model”, you create a list of Car Versions that it provides. Create a LISTOF property that enables the user to enter Car Versions in the “Car Model” definition. Car Versions is a definition type with a compound key: when you the “Car Version”, you must specify the “Car Version”, and the “Car Brand” and the “Car Model” of the “Car Version”.
DEFINITION "Car Model"
{
Property "Make"
{ KEY EDIT ONEOF "Car Brand" RELATE BY "is keyed by" REQUIRED}
Property "Versions"
{ EDIT LISTOF "Car Version"}
}
There is a problem with the preceding example: “Car Version” is a compound-key definition:
it has its own name as a key, and
it has two other key properties, “Car Brand” and “Car Model”.
If you specify the USPROPS.TXT above, it is up to the user to know this. They have to type the “Car Version”, fully qualified by its Brand and Model, with a period separating each, for example:
Ford.Mustang."GT Convertible"
Next, see Adding the KEYED BY statement.
See also
Examples of key and keyed by