Get Datadictionary object from File Number: Difference between revisions
From DataFlex Wiki
Jump to navigationJump to search
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...' |
Hsymington (talk | contribs) m Added to Tutorials category |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
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: | 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 | <source lang="dataflex"> | ||
String sClassID | Function Create_DDO_From_TableName String sTableName Returns Handle | ||
String sEvalClassId | String sClassID | ||
Handle hoDD | String sEvalClassId | ||
Integer iClassID | |||
Handle hoDD | |||
Move "" To sClassID | Move "" To sClassID | ||
Line 12: | Line 14: | ||
Move (SFormat("U_%1_DataDictionary", sTableName)) to sClassId | Move (SFormat("U_%1_DataDictionary", sTableName)) to sClassId | ||
Move (Eval(sClassId)) to sEvalClassId | Move (Eval(sClassId)) to sEvalClassId | ||
Send Trap_Error Of Error_Object_ID 54 | |||
If (sClassId <> sEvalClassId) Begin | If (sClassId <> sEvalClassId) Begin | ||
Move (Cast(sEvalClassId,Handle)) To hoDD | Move (Cast(sEvalClassId,Handle)) To iClassID | ||
Get Create of Desktop iClassID to hoDD | |||
If (hoDD<>0) Begin | |||
// set a name so it is easier to recognize in the debugger | |||
Set Name of hoDD to ("Global_"+sTableName+"_DD") | |||
End | |||
End | End | ||
Function_Return hoDD | Function_Return hoDD | ||
End_Function // | End_Function // Create_DDO_From_TableName | ||
</source> | |||
This assumes your DD's are called TableName_DataDictionary, like the pre 14.1 standard was. | This assumes your DD's are called TableName_DataDictionary, like the pre 14.1 standard was. | ||
==== External links ==== | ==== External links ==== | ||
[http://support.dataaccess.com/Forums/showthread.php?40381-Get-DataDictionary-Object-from-File-Number Get DataDictionary Object from File Number]] | [http://support.dataaccess.com/Forums/showthread.php?40381-Get-DataDictionary-Object-from-File-Number Get DataDictionary Object from File Number]] | ||
[[Category:How To]] | |||
[[Category:Tutorials]] |
Latest revision as of 11:44, 25 March 2020
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 Create_DDO_From_TableName String sTableName Returns Handle String sClassID String sEvalClassId Integer iClassID 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 Send Trap_Error Of Error_Object_ID 54 If (sClassId <> sEvalClassId) Begin Move (Cast(sEvalClassId,Handle)) To iClassID Get Create of Desktop iClassID to hoDD If (hoDD<>0) Begin // set a name so it is easier to recognize in the debugger Set Name of hoDD to ("Global_"+sTableName+"_DD") End End Function_Return hoDD End_Function // Create_DDO_From_TableName
This assumes your DD's are called TableName_DataDictionary, like the pre 14.1 standard was.