Try OpenEdge Now
skip to main content
New Information
ABL for Business Entities : Foreign key support
 

Foreign key support

Specify the field-level Foreign Key annotation on a child temp-table for which you want to define a look up in a given parent temp-table using the following syntax:
@openapi.openedge.entity.foreignkey ( [ name="foreign-key-name", ]
fields="child-field", parent="parent-temp-table", parentFields="parent-field" ).
foreign-key-name
The name of this foreign key on the associated child temp-table. If you do not specify the name attribute to specify a foreign key name, the value you specify for parent-temp-table (see below) is used to create a foreign key name.
child-field
A single field in the child temp-table that defines the foreign key. This field must have a data type that is compatible with a field in the parent temp-table whose value must match to satisfy the look up.
parent-temp-table
A reference to the parent temp-table, which you specify as resource.parentTTname, where resource is the annotated name of the Data Object resource that defines the temp-table, and parentTTname is the name of the parent temp-table, defined in the Business Entity that implements that resource.
parent-field
A single field in the parent temp-table that defines a candidate (or primary) key. This field must represent a value in the parent temp-table, on which a unique match can be found with the foreign key value in the child temp-table.
Foreign Key annotations have the following additional requirements and options:
*The Foreign Key annotation syntax identifies a fields attribute for the child temp-table and a parentFields attribute for the parent temp-table, implying that multiple fields can be specified to define a foreign key and its corresponding candidate key. However in Release 11.7.1, only a single field is supported to define both the foreign key on the child and the corresponding candidate key on the parent.
*The Data Object resource that defines the parent temp-table can be a different resource from the one that defines the child temp-table. However, both resources must be provided by the same Data Object Service. That is, they must be defined in the same Data Service Catalog.
*If the resource that defines the parent temp-table is for a ProDataSet, this temp-table must be a top-level temp-table in that ProDataSet. In other words, it cannot be a child temp-table in any data-relationship defined for the ProDataSet.
*The parent temp-table can be the same as the child temp-table. That is, the look up from child in the parent can be recursive.
*You can specify more than one Foreign Key annotation on a given child temp-table so look ups can be performed in multiple parent temp-tables using different foreign keys defined on the same child temp-table.
You can also specify Foreign Key annotations for a Business Entity using the Edit Annotations page of the Define Service Interface wizard in Progress Developer Studio for OpenEdge. For more information, see Support for Foreign Key Annotation.
For more information on using foreign keys to define lookups for web apps in Kendo UI Builder, see the following Kendo UI Builder by Progress documentation:
*Kendo UI Builder by Progress: Modernizing OpenEdge Applications
*Kendo UI Builder by Progress: Using Kendo UI Designer