Class: DataDictionary
Properties | Events | Methods | Index of Classes
This class provides the main method for accessing databases in DataFlex programs.
Hierarchy
Library: Common (Windows and Web Application) Class Library
Package: Datadict.pkg
Description
Data Dictionaries
Data Dictionaries are one of the most important and 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:
-
Effective Interaction: It lets your application interact more effectively with your database. Data Dictionaries provide your application with a wealth of information about your database that is not part of your physical database. It extends your database.
-
Data Protection: It protects your data by ensuring that only valid data is added to your database.
-
Centralized Logic: It centralizes application logic. All of the information and rules about a Table are stored in a single place. If you need to make a change, you make a change in a single place, and all parts of your application acquire the change.
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.
Syntax
Object {DDOName} is a {DataDictionaryClassName}
End_Object
or
Object {DDOName} is a {DataDictionaryClassName}
Set DDO_Server to {Parent1-DDOName}
Set DDO_Server to {Parent2-DDOName}
Set Constrain_File to {ParentTableName}.File_Number
End_Object
Argument Explanation
Usage
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
End_Object
Object oInvt_DD is a Invt_DataDictionary
Set DDO_Server to oVendor_DD
End_Object
Object oCustomer_DD is a Customer_DataDictionary
End_Object
Object oSalesp_DD is a Salesp_DataDictionary
End_Object
Object oOrderhea_DD is a Orderhea_DataDictionary
Set DDO_Server to oCustomer_DD
Set DDO_Server to oSalesp_DD
End_Object
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
End_Object
Set Main_DD to oOrderhea_DD
Set Server to oOrderhea_DD
Data Dictionary SQL Filters
Data Dictionaries support SQL filters. See pbUseDDSQLFilters for details.
Relationships
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 how the constraint engine uses 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 DD's 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.