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.
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> AtTables5Count = DCOUNT(@Tables(5), @FM) For i = 1 To AtTables5Count 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