Use COPY-DATASET with a dynamic target ProDataSet
- Last Updated: February 11, 2026
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
This first COPY-DATASET example
shows how to copy a static source ProDataSet to a dynamic target,
and have the AVM create the structure of the target before copying
into it. The sample procedure is called DynCopy.p.
It first includes the same static temp-table and ProDataSet definitions
used elsewhere. It then defines variables to hold the handles of
the target dynamic ProDataSet, its top-level buffer, and a dynamic
query for that buffer, as shown:
|
The procedure next defines a static query for
the Order table, along with the Data-Sources the
ProDataSet uses, as shown:
|
It then prepares the source ProDataSet query
to retrieve Orders for Customer 1,
along with their OrderLines and Items, and
attaches the Data-Sources. The FILL brings all
this data into the source ProDataSet, as shown:
|
A simple DISPLAY loop confirms
that the Orders are in the source ProDataSet dsOrder and
its ttOrder temp-table, as shown:
|
The procedure creates the dynamic ProDataSet
using the handle hDataSet2, as shown:
|
This is initially an empty structure for a ProDataSet.
It has no table or relation definitions. The COPY-DATASET method
copies the table and Data-Relation structure from dsOrder to
the new dynamic ProDataSet, and then its data. To verify that both
the definition and its data have been copied, the procedure creates
a dynamic query for the top-level table in the new ProDataSet and
prepares the query to navigate its rows.
As explained above,
the COPY-DATASET method gives the new dynamic buffer
the name "cpy_" plus the source buffer name, as
shown:
|
The procedure opens the dynamic query and walks
through all the rows at the top level of the target ProDataSet,
displaying the same OrderNum and CustNum fields
to verify that it contains the same data as the source, as shown:
|
When you run the procedure it shows you the Orders in
both ProDataSets:
