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.

Share this post

Leave a comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

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.