Skip to main content Skip to complementary content

Adding a foreign key in a complex type

About this task

When defining a complex type, you can add a foreign key element in the complex type. In this case, any entity or element using this complex type or using a complex type which extends this complex type can reuse the foreign key.

The following example shows how to add a foreign key AddressFK to the complex type AddressType created in Adding complex type elements to entities which are extended by EUAddressType and USAddressType.

Procedure

  1. From the Palette, click Foreign Key.
  2. Go to the Data Model Types area, and click the source complex type to which you want to add the foreign key element, and hold the mouse until the link reaches the target entity to which you want to link the source complex type.
    If the target entity is too far away to be reached by the link, you can click the source complex type first and then release the mouse in the blank area. In this case, the target entity needs to be selected from the Reference entity list.
    A dialog box pops up.
  3. Enter a name for the foreign key element. In this example, AddressFK.
  4. Click OK to close the dialog box.
    The foreign key element is added to the complex type AddressType.

Results

When you added a foreign key element to a complex type, any element or entity which uses this complex type or uses complex types extending this complex type will reuse the foreign key as well.

For example, suppose you have a Region entity in the DStar data model, and now you want to add a new element of the complex type AddressType to the Region entity. The foreign key AddressFK will be reused.

If you add a new element of EUAddressType to the Region entity, the foreign key AddressFK is also reused.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!