Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

IncRegua

IncRegua()

Increments the processing bar used in the RptStatus flow.

AdvPL functionsInterfaceProcessingRptStatusUnder review
01 · OVERVIEW

Overview

IncRegua increments the processing bar associated with RptStatus after the total has been defined by SetRegua. It is useful in routines that scan queries or lists and need to show visual progress to the user. Keep this flow separate from Processa, which usually works with ProcRegua and IncProc.

02 · SYNTAX

Syntax

IncRegua()

Return value

The consulted reference does not document a return value. Use the function as a visual meter increment.

03 · PRACTICAL EXAMPLE

Increment a bar in RptStatus

#Include "TOTVS.ch"
#Include "TopConn.ch"

User Function RunRptStatus()
    Local aArea := GetArea()

    RptStatus({|| U_QueryMeter()}, "Please wait...", "Running query...")

    RestArea(aArea)
Return

User Function QueryMeter()
    Local aArea  := GetArea()
    Local nTotal := 0

    TCQuery "SELECT BM_GRUPO, BM_DESC FROM %table:SBM% SBM WHERE SBM.D_E_L_E_T_ = ' '" New Alias "QRY_AUX"

    Count To nTotal
    SetRegua(nTotal)

    QRY_AUX->(DbGoTop())
    While ! QRY_AUX->(Eof())
        // Process current row.
        IncRegua()
        QRY_AUX->(DbSkip())
    EndDo

    QRY_AUX->(DbCloseArea())
    RestArea(aArea)
Return
Expected result

SetRegua defines the total number of records and IncRegua advances the bar for each processed record.

BEST PRACTICES
  • Use SetRegua before calling IncRegua.
  • For queries, a previous count may define the meter total.
  • Preserve and restore work areas with GetArea and RestArea when opening work aliases.
COMMON PITFALLS
  • Do not confuse IncRegua with IncProc.
  • Avoid counting records in very heavy queries without evaluating performance cost.
  • Close the temporary alias after processing.

Related content

REFERENCES
  1. ATILIO, Daniel. IncRegua. Terminal de Informação knowledge base.
Status
Under review
Page created on
Last reviewed on
Original language
Português
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