GetNextAlias and dynamic aliases
GetNextAlias() -> cAliasAvoids fixed aliases and defines ownership of temporary areas.
Overview
GetNextAlias supplies an identifier for later opening; obtaining a name does not open a table. The example uses it with FWTemporaryTable and closes only the table it creates. Do not retain names for indefinite reuse or close all process areas as cleanup. (Sources: refs. 1–1.)
Syntax
GetNextAlias() -> cAliasCommented example
#Include "Protheus.ch"
User Function Ed472()
Local cAlias := GetNextAlias()
Local oTmp := FWTemporaryTable():New(cAlias,{{"ED_COD","C",6,0}})
// Open and close only the resource created here.
oTmp:Create()
ConOut(oTmp:GetAlias())
oTmp:Delete()
FreeObj(oTmp)
Return NilCreates and removes an empty table with a dynamic alias. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Provide cleanup on error exits; TempDB remains restricted to the creating thread.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.