Define a dataset
- Last Updated: October 29, 2021
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
This main steps for defining a dataset are:
- Define a temp-table for each table you want to use in the dataset.
- Define the dataset by specifying the temp-tables and their relationships (if any).
Define the temp-tables
To define a temp-table you use the DEFINE TEMP-TABLE statement. When defining a temp-table
manually, you specify each field and index in the temp-table definition. You can
define each field as a specific data-type, as you would in a DEFINE VARIABLE statement. To define a temp-table with specific fields
and indexes, use this syntax:
|
The before table is used when a dataset is updated so that the original and updated data can be stored in the dataset before it is committed to the database.
Here is an example of the DEFINE
TEMP-TABLE statement:
|
Define the dataset
DEFINE DATASET statement is a complex statement with multiple
components. You use it to:- Name the dataset and specify the temp-tables that comprise the dataset.
- Define any data-relations between those temp-tables.
To define a dataset, you use the DEFINE
DATASET statement. Here is the simplified syntax:
|
- dataset-name
- Specifies the name of the dataset.
- temp-table-name
- Specifies the name of the temp-table(s) in the dataset.
- data-relation-name
- Specifies a data-relation object. See ProDataSet relations for more detail.
- parent-temp-table-name, child-temp-table-name
- Identifies the parent and child temp-tables for the data relation.
- parent-fieldn, child-fieldn
- Define the relationship between fields in the temp-tables.
For the most efficient joins, the
RELATION-FIELDSfields should be indexed.
The following example defines a dataset called dsOrderOrderLine. It is comprised of two temp-tables
called ttOrder and ttOrderLine. It states that the relationship between the two tables is
based upon the ordernum fields. In this example the
fields in the two tables have the same name, but they don't need to be. You can also
specify relation-fields that have different names.
|
You can define more than one data-relation for a dataset and include more than two temp-tables. The following is an example:
|
You can learn more about datasets in the Datasets Guided Journey or Use ProDataSets guide.