Omit foreign key fields in nested child records
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
When working with a nested data relation in a ProDataSet, the fields that define the relationship appear in both the parent record and the child records. Because the child records are contained within the parent record, the foreign key fields in the child records are redundant.
You can choose to omit foreign key fields by:
- Specifying the
FOREIGN-KEY-HIDDENoption on aDEFINE DATA-RELATIONstatement - Specifying the
foreign-key-hiddenargument on theADD-RELATION( )method of a Data-relation object - Setting the
FOREIGN-KEY-HIDDENattribute of a Data-relation object toTRUE
In all three cases, the NESTED option must also
be specified.
Care must be taken when deciding to use this feature. The READ-XML( ) method automatically populates
foreign keys in nested child records with the value in the outer parent
record when the foreign key is omitted from the XML document. Unless you
are sure that a non-ABL consumer of the XML document will do the
same, you should not use this option in your nested data-relations.
For example, while .NET can read this XML document and populate an ADO.NET Dataset, it will create rows in the child DataTable with a null value for the foreign key field.