Define a dataset
- Last Updated: October 20, 2021
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
DEFINE DATASET statement is a complex statement with
multiple components. You use the statement to:- Name the dataset and specify the temp-tables that comprise the dataset.
- Define any data-relations between those temp-tables.
Data-relations control how a dataset is populated. (Dataset population
is typically done through the FILL() method, which is
discussed later in this track). Data-relations in a dataset are different from OpenEdge
database tables where there are no defined relationships. In a database the
relationships are based on data values only and record retrieval of parent and children
is based on a join query. In contrast in a dataset, any query used for filling the
dataset is defined by each temp-table independently. So, the data-relation tells the AVM
how the join is defined.
Syntax for the DEFINE DATASET statement
To define a dataset, you use the DEFINE
DATASET statement. The following is the simplified syntax:
|
- dataset-name
- Specifies the name of the dataset.
- buffer-name
- Specifies the name of the buffer on the temp-table(s) in the dataset.
- data-relation-name
- Specifies a data-relation. See ProDataSet relations in Use ProDataSets 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 are indexed.
Examples of the DEFINE DATASET statement
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 the names don't need to be the same. You can 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:
|