Attach_Main_File

Attach_Main_File performs an attach. It gets called during save and find operations.  An Attach moves related field data from a parent table to the DDO’s table. This insures that the relationship values between tables are properly maintained.

Note that this attach is only applied to parent DDOs that are connected to this DDO. If a parent table is related to the DDO’s main-file but there is no parent DDO connected to the DDO, no attach will occur.

You can use this procedure to create additional attaches, to cancel all attaches, or to create your own custom attaches. The following sample performs a normal attach except that one of the field's attaches is ignored.

Procedure Attach_Main_File

    String sTempVal

    Move Vndr.Parent_Stat to sTempVal // remember this value

    // the normal attach will attach data from all parent files

    // including an attach into Vndr.Parent_Stat. We want to

    // ignore this attach

    Forward Send Attach_Main_File

    Move sTempVal to Vndr.Parent_State // undo this one attach

End_Procedure

Note that Attach_Main_File and Relate_Main_File are not true inverses of each other. Relate_Main_File does nothing by default (the relate occurs as part of the find). Attach_Main_File actually performs the attach command. If you do not forward, the message no attach will occur.

When accessing table values you should always access the global file buffers and not the DDO buffers (i.e., use “Move File.Field to var” syntax). See Understanding File Buffers and DDO Field Buffers for more information.

See Also

Defining Data Dictionary Events