Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

RESTAREA()

RestArea(aArea)

Restores alias, order and position saved by GetArea.

RESTAREA()AdvPL
01 · OVERVIEW

Overview

RestArea consumes the GetArea array and restores alias, IndexOrd and Recno. The last restored area becomes active. It does not automatically reopen closed areas or restore every possible state, such as transactions, company environment or filters outside this contract. Save a second area separately if you change it, and restore the original area last. Evaluate FWGetArea/FWRestArea for the release framework. (Sources: refs. 1–2.)

02 · SYNTAX

Syntax

RestArea(aArea)

Parameters

aArea
ArrayRequired

Snapshot from GetArea with unchanged structure.

Return value

Unused; selected reference specifies no useful return.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed620()
    // Uninvoked block: requires an open area that has been preserved.
    Local bRestore := {|aArea| RestArea(aArea)}
    ConOut(ValType(bRestore))
Return Nil
Expected result

Creates block B without inventing an area snapshot. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Never close caller-owned aliases. Plan restoration on errors too.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. RestArea. TDN. Accessed on 2026-10-27.
  2. Atilio. dan-atilio/AdvPL. Maratona de Exemplos/Exemplo_220_Funcoes_FWGetArea_FWRestArea_GetArea_e_RestArea.prw. Arquivo completo consultado; adaptação editorial. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR

Was this content helpful?

👍 Like 0👎 Dislike 0

Sign in to rate this article.

0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha