Try OpenEdge Now
skip to main content
Working with XML
Reading and Writing XML Data from Temp-Tables and ProDataSets : Writing XML from a temp-table, temp-table buffers, or a ProDataSet : Omitting foreign key fields in nested child records
 

Omitting foreign key fields in nested child records

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-HIDDEN option on a DEFINE DATA-RELATION statement
*Specifying the foreign-key-hidden argument on the ADD-RELATION( ) method of a Data-relation object
*Setting the FOREIGN-KEY-HIDDEN attribute of a Data-relation object to TRUE
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.