Skip to content

Using Data Dictionary Objects in your Components

Data Dictionaries are implemented within an application:

  1. Creating the Data Dictionary Classes for each Table
  2. Creating Data Dictionary Object Structures in your components
  3. 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 below 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
Move File.Field to sValue Get the unchanged value of file-buffer and move it to a variable. Often used in reports. Use this syntax within DDO events:
dataflex<br> Move Customer.Name1 to sName1<br>
Move sValue to File.Field 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:
dataflex<br> Move sName1 to Customer.Name1<br>
Get File_Field_Current_Value Get the current DDO field value. Do not use this in DDO events:
dataflex<br> Get File_Field_Current_Value of oCustomer_DD ;<br> File_Field Customer.Name to sName<br>
Set File_Field_Changed_Value Set a DDO changed value in preparation of a save. Do not use within DDO Events:
dataflex<br> Set File_Field_Changed_Value of oCustomer_DD ;<br> File_Field Customer.Name to sName<br>
Send Clear Clear the DDO and all parents unless a relates-to constraint is encountered:
dataflex<br> Send Clear of oCustomer_DD<br>
Send Clear_All Clear all DDOs, up and down, in the DDO structure:
dataflex<br> Send Clear_All of oCustomer_DD<br>
Get Request_Validate Validate all DDO fields. Return non-zero if error. Often used before a Request_Save. Tables are not locked at this point:
dataflex<br> Get Request_Validate of oCustomer_DD to bErr<br> If not bErr begin<br> Send Request_Save of oCustomer_DD<br> Move (Err) to bErr<br> End<br>
Send Find 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:
dataflex<br> Send Clear of oCustomer_DD<br> Move sId to Customer.Id<br> Send Find of oCustomer_DD EQ 1<br> Move (Found) to bExists<br>
Send FindByRowId Find by record ID for passed File and RowId:
dataflex<br> Send FindByRowId of oCustomer_DD ;<br> Customer.File_Number riRecId<br> Move (Found) to bExists<br>
Send Request_Delete Delete the current record in the DDO. If failure, Err is set true:
dataflex<br> Send Request_Delete of oCustomer_DD<br> Move (Err) to bErr<br>
Send Request_Save Save DDO and all parent DDOs. If failure, Err is set true:
dataflex<br> Get Request_Validate of oCustomer_DD to bErr<br> If not bErr begin<br> Send Request_Save of oCustomer_DD<br> Move (Err) to bErr<br> End<br>
Get HasRecord Returns true if the DDO has a current record:
dataflex<br> Get HasRecord of oCustomer_DD to bHasRecord<br>
Get CurrentRowId Return the DDO’s current RowId. If null, a new record:
dataflex<br> Get CurrentRowId of oCustomer_DD to riRowId<br>
Get Should_Save Is DDO changed – is save needed. Checks DDO and parents:
dataflex<br> Get Should_Save of oCustomer_DD to bChanged<br>
Send Rebuild_Constraints Sent to change the finding filters (constraints). The OnConstrain event inside of your DDOs will get called and this will define your new constraints:
dataflex<br> Send Rebuild_Constraints of oCustomer_DD<br> Send Find of oCustomer_DD First_Record 1<br>