Skip to content

Instantly share code, notes, and snippets.

@jbratu
Created July 7, 2016 21:16
Show Gist options
  • Save jbratu/1d731be9c5e9bfcbdc7be78d4b6c0cd2 to your computer and use it in GitHub Desktop.
Save jbratu/1d731be9c5e9bfcbdc7be78d4b6c0cd2 to your computer and use it in GitHub Desktop.
Function accepts and OpenInsight table handle and resolve the handle back to a 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 ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment