Get Datadictionary object from File Number

From DataFlex Wiki
Revision as of 11:39, 24 February 2011 by Wil (talk | contribs) (Created page with '== Get DataDictionary Object from File Number == If you have nothing except the table number, you can find the table name, construct the data dictionary class name from that, an...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Get DataDictionary Object from File Number

If you have nothing except the table number, you can find the table name, construct the data dictionary class name from that, and use Eval to get the class id:

 Function DDO_From_TableName String sTableName Returns Handle
   String sClassID 
   String sEvalClassId
   Handle hoDD
   
   Move "" To sClassID
   Move 0  To hoDD
   Send Ignore_Error Of Error_Object_ID 54
   Move (SFormat("U_%1_DataDictionary", sTableName)) to sClassId
   Move (Eval(sClassId)) to sEvalClassId
    
   If (sClassId <> sEvalClassId) Begin
     Move (Cast(sEvalClassId,Handle)) To hoDD
   End
   Send Trap_Error Of Error_Object_ID 54
   Function_Return hoDD
 End_Function // DDO_From_TableName

This assumes your DD's are called TableName_DataDictionary, like the pre 14.1 standard was.

After you have the class id, just use Create of Desktop to create an instance of the class.

External links

Get DataDictionary Object from File Number]