Define the Keys of a Modeled Entity
Each modeled entity must have a primary key.
At least one field must be defined in the modeled entity.
For a database entity, the primary key is used to uniquely identify each record in the database, and for use in relationships between entities. Even non-database entities need a primary key to ensure that they can be correctly compiled when used in a component.
-
Open the entity and go to the
Define Keys/Indexes worksheet.
The Key Editor shows the entity object and the primary key object, which is always named number
1
. -
In the Resource Browser, select one or more fields that should make up the primary key, and drag them and drop them onto the key object.
Primary Key of ORDERLINE.SALESTip: You can filter the list of available fields in the Resource Browser by starting to type a field name or keyword in its U-Bar.
-
To create a candidate key or index
- Right-click the entity and choose Create Key from the context menu.
- Modify the Key Type field to choose
Candidate
orIndex
(the default). - Select one or more fields in the Resource Browser and drag them and drop them onto the key object.
After the keys are defined, it is possible to create relationships between entities. For more information, see Define Relationships Between Modeled Entities.