Define_Fields - DataDictionary

Defines DataDictionary rules for data file fields at the class level

Type: Event

Obsolete


Parameters: None

Syntax
Procedure Define_Fields 

Description

Obsolete

Prior to DataFlex version 14.1, the Define_Fields was the event that defined the rules for your data dictionary. As of version 14.1, these rules are now defined directly in the class's constructor, Construct_Object. When migrating to version 14.1 or above, your code will be moved from Define_Fields into Construct_Object. While data dictionaries that use Define_Fields can still be compiled and run, they can not be properly modeled in the Studio. Therefore you should no longer place code in this event and you should make sure that all of the data dictionary classes are properly migrated.

The documentation below is maintained for compatibility sake. Both the event and some of the code within the event is now obsolete.


The Define_Fields event defines DataDictionary rules for data file fields at the class level. This event is called by Construct_Object and is designed to be augmented at the class level to set up all data-dictionary rules. The Main_File property must be set before any other property; property settings that precede the setting of this property will not take effect.

Note:Since Define_Fields is called from Construct_Object, it cannot be augmented at the DataDictionary object (DDO) level, only at the class level.


Sample

(see Customer.DD in the DataFlex Order10 sample for more detail)

Class Customer_Data_Dictionary is a DataDictionary
    :
    Procedure Define_Fields
        Forward Send Define_Fields
        //DDB-Generated-Code-Location
        //DDB-DefineFieldStart

        Set Main_File            To Customer.File_Number
        Set Cascade_Delete_State To False

        Set Foreign_Field_Options  DD_KEYFIELD   To DD_FINDREQ    
        Set Foreign_Field_Options  DD_INDEXFIELD To DD_NOPUT      
        Set Foreign_Field_Options  DD_DEFAULT    To DD_DISPLAYONLY

        // Child (Client) file structure................
        Send Add_Client_File  Orderhea.File_Number

        // External (System) file structure.............
        Send Add_System_File  Ordsys.File_Number  DD_LOCK_ON_NEW_SAVE

        Define_Auto_Increment  Ordsys.Cust_Number  To Customer.Customer_Number

        // Field-based properties.......................

        // Customer.Customer_Number
        Set Field_Label_Long       Field Customer.Customer_Number To "Customer Number"
        Set Field_Label_Short      Field Customer.Customer_Number To "Number"
        Set Field_Options          Field Customer.Customer_Number To DD_AUTOFIND    DD_NOPUT      
        Set Field_Prompt_Object    Field Customer.Customer_Number To (Customer_sl(Self))
        Set Key_Field_State        Field Customer.Customer_Number To True
        Set Status_Help            Field Customer.Customer_Number To "Customer Id Number (system assigned)."

        // Customer.Name
        Set Field_Label_Long       Field Customer.Name To "Customer Name"
        Set Field_Label_Short      Field Customer.Name To "Customer Name"
        Set Field_Options          Field Customer.Name To DD_REQUIRED   
        Set Field_Prompt_Object    Field Customer.Name To (Customer_sl(Self))
        Set Status_Help            Field Customer.Name To "Customer/Company Name."
        :
        :
        :
        //DDB-DefineFieldEnd
    End_Procedure  //  Define_Fields
    :
End_Class