foreignkey property

The foreignkey property, @openapi.openedge.entity.foreignkey, is added at the entity level in the schema to specify the foreign key of an entity. It specifies the relationships of an entity to other entities, which may not be defined in the same resource (for a DataSet) or in the same catalog.

Progress Developer Studio for OpenEdge generates annotations to specify the foreign keys if it can find fields that correspond to the indexes in a unique index on another table.

When you generate a Business Entity class file from an express Data Object project or from a database table (that has a foreign key constraint on it) in the New Business Entity wizard, Progress Developer Studio for OpenEdge reads the respective information from the database and adds the foreignkey annotation above the temp-table definition.

Sample foreignkey annotation for a table that has a foreign key constraint on it:

@openapi.openedge.entity.foreignkey (fields="ORDERNUM,Linenum", parent="ORDER", parentFields="ORDERNUM,Linenum"). 

DEFINE TEMP-TABLE ttOrderLine BEFORE-TABLE bttOrderLine
FIELD Discount AS INTEGER INITIAL "0" LABEL "Discount"
FIELD ExtendedPrice AS DECIMAL INITIAL "0" LABEL "Extended Price"
FIELD Itemnum AS INTEGER INITIAL "0" LABEL "Item Num"
FIELD Linenum AS INTEGER INITIAL "0" LABEL "Line Num"
FIELD OrderLineStatus AS CHARACTER INITIAL "Ordered" LABEL "Order Line Status"
FIELD Ordernum AS INTEGER INITIAL "0" LABEL "Order Num"
FIELD Price AS DECIMAL INITIAL "0" LABEL "Price"
FIELD Qty AS INTEGER INITIAL "0" LABEL "Qty"
INDEX itemnum  Itemnum  DESCENDING 
INDEX orderline IS  PRIMARY  UNIQUE  Ordernum  DESCENDING  Linenum  DESCENDING 
INDEX OrderLineStatus  OrderLineStatus  DESCENDING 
INDEX SYS_001_000000004  Ordernum  DESCENDING . 

DEFINE DATASET dsOrderLine FOR ttOrderLine.

You can manually change the value of the foreignkey annotation in the Business Entity class file.