Add relations to tables through extension
To enable rich and secure interactions with data in multiple tables, you must help guarantee referential integrity by defining relations that describe the link between two tables. By defining relations, you enable validation of the data that is entered and lookup capabilities for the related information.
You can add a new relation by extending a table.
In the following example, a new field, MyInventLocationId, is added to the InventTable table. This field is a reference to the InventLocation table that contains warehouses.
- In the new extension model, create an extension of the InventTable table.
- Create a new relation, just as you would create a relation on a regular table.
- Specify the Related Table, Relationship Type, and Cardinality properties, and any other properties that apply to the relation.
- Add the link by specifying the fields from the InventTable table and the InventLocation table that have the same value. In this case, the fields are MyInventLocationId in the InventTable table and InventLocationId in the InventLocation table.
The following illustration shows the new relation.