Data Dictionaries are implemented within an application:
Creating the Data Dictionary Classes for each Table
Creating Data Dictionary Object Structures in your components
Using those Data Dictionary Objects in your component
This section describes the third step.
DDO structures are used either by Data Entry Objects (DEOs) or by custom methods.
When you use DEOs to work with DDOs, the interface between the DEOs and DDOs is largely hidden. In fact, you can build entire data-entry components using the DataFlex Studio without having to write any code to manipulate the DDOs.
If you are accessing DDOs within methods, perhaps as part of a Business Process, Web Browser process or a Web service, you must write the code to communicate with the DDOs. The interface you will use is the same interface the DEOs use – you just have to write the code to use it yourself.
This section will concentrate on what is needed to write that code. Although all of the major DDO operations will be discussed in terms of both DEO and code based usage, most of the attention will be placed on working with DDOs with code.
Even when writing your own code, the number of commands and messages required to work with DDOs is rather small. Listed is a table of the most common table-related commands and Data Dictionary Object messages. These are the commands and messages that you are most likely to use when working with Data Dictionary objects within your application. All of these will be discussed in detail.
Command or Message |
Purpose / Sample |
Get the unchanged value of file-buffer and move it to a variable. Often used in reports. Use this syntax within DDO events Move Customer.Name1 to sName1 |
|
Seed File Buffer in preparation of a find. Move data into the File buffer. Do not use in preparation of a save. Use this syntax within DDO events. Move sName1 to Customer.Name1 |
|
Get the current DDO field value. Do not use this in DDO events. Get File_Field_Current_Value of oCustomer_DD ; File_Field Customer.Name to sName |
|
Set a DDO changed value in preparation of a save. Do not use within DDO Events. Set File_Field_Changed_Value of oCustomer_DD ; File_Field Customer.Name to sName |
|
Clear the DDO and all parents unless a relates-to constraint is encountered. Send Clear of oCustomer_DD |
|
Clear all DDOs, up and down, in the DDO structure. Send Clear_All of oCustomer_DD |
|
Validate all DDO fields. Return non-zero if error. Often used before a Request_Save. Tables are not locked at this point. Get Request_Validate of oCustomer_DD to bErr If not bErr begin Send Request_Save of oCustomer_DD Move (Err) to bErr End |
|
Find a record passing find mode and index. Find based on data in the file buffer and not on data in the DDO Field buffer. Send Clear of oCustomer_DD Move sId to Customer.Id Send Find of oCustomer_DD EQ 1 Move (Found) to bExists |
|
Find by record ID for passed File and RowId. Send FindByRowId of oCustomer_DD ; Customer.File_Number riRecId Move (Found) to bExists |
|
Delete the current record in the DDO. If failure, Err is set true. Send Request_Delete of oCustomer_DD Move (Err) to bErr |
|
Save DDO and all parent DDOs. If failure, Err is set true. Get Request_Validate of oCustomer_DD to bErr If not bErr begin Send Request_Save of oCustomer_DD Move (Err) to bErr End |
|
Returns true if the DDO has a current record. Get HasRecord of oCustomer_DD to bHasRecord |
|
Return the DDO’s current RowId. If null, a new record. Get CurrentRowId of oCustomer_DD to riRowId |
|
Is DDO changed – is save needed. Checks DDO and parents. Get Should_Save of oCustomer_DD to bChanged |
|
Sent to change the finding filters (constraints). The OnConstrain event inside of your DDOs will get called and this will define your new constraints. Send Rebuild_Constraints of oCustomer_DD Send Find of oCustomer_DD First_Record 1 |