Try OpenEdge Now
skip to main content
ProDataSets
Dynamic ProDataSet Basics : Creating a dynamic ProDataSet
 

Creating a dynamic ProDataSet

Here is the syntax for dynamically creating a ProDataSet:

Syntax

CREATE DATASET dataset-handle [ IN WIDGET-POOL poolname ].
Instead of defining a static ProDataSet, you create a dynamic ProDataSet when part or all of its definition has to be determined at run time. For example, you might need data in the application or from specific user requests to define your ProDataSet. The CREATE DATASET statement gives you a handle in the variable dataset-handle, which you can then use to build up the ProDataSet through additional statements that add buffers and relations to it, much as you build up a dynamic query or temp-table.
Note: If you do not specify the WIDGET-POOLpoolname syntax to allocate storage in a specific named widget pool, you might expect that the ProDataSet will be created in the closest unnamed widget pool. This is the default behavior for other objects such as dynamic queries. Instead, the ProDataSet goes into the session's unnamed widget pool. This is necessary because the ProDataSet object must be able to serve as an output parameter. Therefore, the object cannot disappear when its defining procedure returns. Deletion must be delayed until the object can be handed off as an output parameter to the calling procedure. Likewise, the ProDataSet cannot go into a pool that is deleted when the procedure is deleted. If you give a pool name for an output parameter ProDataSet, remember that the pool must outlive the procedure where it is created.
The CREATE statement simply allocates storage for the ProDataSet description and puts a pointer to that storage into the dataset-handle variable. You must then run methods on the ProDataSet handle to define its buffers and relations. At this point, you can:
*Manipulate this new dynamic ProDataSet as a dynamic object
*Pass it locally or remotely into a static definition
*Pass it to another procedure that can receive and operate on it as a dynamic object
* Passing ProDataSets