Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

GetNextAlias and dynamic aliases

GetNextAlias() -> cAlias

Avoids fixed aliases and defines ownership of temporary areas.

GetNextAlias and dynamic aliasesAdvPL
01 · OVERVIEW

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

02 · SYNTAX

Syntax

GetNextAlias() -> cAlias
03 · PRACTICAL EXAMPLE

Commented 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 Nil
Expected result

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

BEST PRACTICES
  • 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.

Related content

REFERENCES
  1. TOTVS. FWTemporaryTable. TDN. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha