Class: DataDictionary

Properties  Events  Methods    Index of Classes

This class provides the main method for accessing databases in DataFlex programs.



Library: Common (Windows and Web Application) Class Library

Package: Datadict.pkg


Data Dictionaries

Data Dictionaries are one of the most important and most complex topics in DataFlex. The Class Reference will provide you with syntactical and usage information, but you should read the Data Dictionary Guide to learn the concepts behind this powerful class.

In DataFlex, your application business rules are expressed through and managed by Data Dictionaries (DDs). Data Dictionaries create a layer between your application logic and your data. This has the following advantages:

Data Dictionary Classes

Data Dictionaries are defined as classes. You will create a Data Dictionary class for each table in your database. These classes will be used while you are building your application and when you run your application.

Data Dictionary classes are built using the Studio's Visual DataDictionary Modeler.

See the Defining Data Dictionary Classes section of the Data Dictionary Guide for conceptual help on building Data Dictionary Classes.


Object {DDOName} is a {DataDictionaryClassName}


Object {DDOName} is a {DataDictionaryClassName}
    Set DDO_Server to {Parent1-DDOName}
    Set DDO_Server to {Parent2-DDOName}
    Set Constrain_File to {ParentTableName}.File_Number

Argument Explanation

{DDOName}The name of the DataDictionary object (DDO)
{DataDictionaryClassName}The name of the DataDictionary subclass object {DDOName} is based on. This subclass is maintained in Database Builder
{Parent1-DDOName},{Parent2-DDOName},...The name of the parent table DDOs
{ParentTableName}The name of a parent table that this {DDOName} is constrained to


This is a typical DataDictionary Object (DDO) structure you would use in a DataFlex component, such as a dbView.

Object oVendor_DD is a Vendor_DataDictionary

Object oInvt_DD is a Invt_DataDictionary
    Set DDO_Server to oVendor_DD

Object oCustomer_DD is a Customer_DataDictionary

Object oSalesp_DD is a Salesp_DataDictionary

Object oOrderhea_DD is a Orderhea_DataDictionary
    Set DDO_Server to oCustomer_DD
    Set DDO_Server to oSalesp_DD

Object oOrderdtl_DD is a Orderdtl_DataDictionary
    Set DDO_Server to oOrderhea_DD
    Set DDO_Server to oInvt_DD
    Set Constrain_File to Orderhea.File_Number

Set Main_DD to oOrderhea_DD
Set Server to oOrderhea_DD

Data Dictionary SQL Filters

Data Dictionaries support SQL filters. See pbUseDDSQLFilters for details.


Relates can either be defined by a table or by the DD. pbUseDDRelates determines if relates are defined by the table or the DD. See pbUseDDRelates for more information.

Smart Relates

pbSmartRelate controls whether DataDictionaries perform relates on parent tables that are not connected to the DDO structure. By default, this is set to True in the DataDictionary class.

Constraint MetaData Methods

DataDictionary Objects (DDOs) can provide information about their DataFlex constraints. These are the constraints that are built up in the OnConstrain event using the Constrain command.

You can query information about all of the constraints for a DDO and you can query information about how the constraint engine uses these for these for a find by a particular index.

Much of this information is technical and would only be used in advanced programming situations. It can also be used when debugging constraints. The Data Dictionary Inspector (DD_Debug.pkg) can show you this information.

Function DDOConstraints Returns tConstraintDef[]
Function DDOConstraintFindMeta Integer eMode Integer iOrder Returns tDDOConstraintFindMeta
Function DDOConstraintNeedsRelate Integer iOrder Returns Boolean

Constraints are built when Rebuild_Constraints is sent to a DDO. The DDO calls OnConstrain, which executes all of the Constrain commands. Each constraint is added to an array of constraints. If the DDO inherits constraints from its parent DDOs (determined by pbInheritConstraints), it will send OnConstrain to the parents and continue to add these parent constraints to the original DDO's array of constraints. Upon completion this array of constraints, which consists of this DDs constraints and possibly parent DD constraints, is what is used to filter all finds for this DDO.

You can query the array of DataFlex constraints by sending the Get DDOConstraints to the DDO after the constraints have been rebuilt.