Lookup OpenInsight Table from Handle
When a table opened for access using the open statement a table handle is returned for locking,reading, and writing records. This function looks up the table handle and returns the corresponding table name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Function CS_RESOLVE_TABLE_HANDLE_TO_NAME(OpenTableHandle) /* Given the example: Open 'SYSLISTS' To OpenTableHandle Else Debug TableName = CS_RESOLVE_TABLE_HANDLE_TO_NAME(OpenTableHandle) The Function will return the name of the table From the handle. */ If Unassigned(OpenTableHandle) Then Return '' FileVarName = OpenTableHandle< 1 , 2 > AtTables 5 Count = DCOUNT(@Tables( 5 ), @FM) For i = 1 To AtTables 5 Count CheckHandle = @Tables( 5 )<i> If CheckHandle EQ FileVarName Then *Found our handle in @TABLES(5) TableName = @Tables( 2 )<i> Return TableName End Next *Couldn't find handle in @TABLES(5) Return '' |
This can be useful in logging or sub-functions that only accept the table handle as a parameter and you need to look-up the table from only it's handle.
Leave a comment