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.

Given the example:
	Open 'SYSLISTS' To OpenTableHandle Else Debug
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

*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.

Share this post

About Us

Congruity Service is a technology solutions company bringing the best technology solutions to OpenInsight projects, Drupal sites, servers, networks, and your technology needs.