IncRegua
IncRegua()Increments the processing bar used in the RptStatus flow.
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.
Syntax
IncRegua()Return value
The consulted reference does not document a return value. Use the function as a visual meter increment.
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)
ReturnSetRegua defines the total number of records and IncRegua advances the bar for each processed record.
- 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.
- Do not confuse IncRegua with IncProc.
- Avoid counting records in very heavy queries without evaluating performance cost.
- Close the temporary alias after processing.

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