After populating a ProDataSet with a PARENT-ID-RELATION, if it is passed as a BY-VALUE parameter, the relationships between parent and child records are lost. The parent and child tables in the new copy of the dataset still have all the records, but anything that relies on the relation (such as writing nested JSON/XML, using .NET grid controls with nested bands, etc.) fails to fetch the expected child records. This behavior is also seen when cloning the ProDataSet via the COPY-DATASET() method.

Passing the dataset BY-VALUE creates a new copy of the dataset. However, the RECID field specified as the PARENT-ID-RELATION's PARENT-ID-FIELD is not updated when the dataset is cloned, so the child table in the new copy still holds the RECID numbers for the parent records in the original dataset, instead of the parent records in the new copy.

To work around this issue:
  • If the dataset stays within the same ABL process, pass the parameter BY-REFERENCE instead of by value.
  • If the dataset needs to be sent to another process (such as when passing between an application server and client), an option would be to serialize it into JSON or XML and pass it as a LONGCHAR parameter instead.