Passing a ProDataSet parameter BY-VALUE breaks PARENT-ID-RELATION
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
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.
- If the dataset stays within the same ABL process, pass the parameter
BY-REFERENCEinstead 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.