Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

DBGoTo

DBGoTo( nPos ) --> Nil

Positions by physical record number.

DBGoToAdvPL
01 · OVERVIEW

Overview

DBGoTo accepts a physical RecNo valid for the table, not a visual row or index-order position. Physical navigation can reach a record outside the filter; never use it as authorization enforcement. The example saves an existing position, moves to the logical top and returns to that number instead of assuming record 1 exists. DBSetFilter documents the distinction between logical navigation and DBGoTo. EDTRB identifies only an owned test table already open with the required schema and permissions; examples are not intended for standard tables. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

DBGoTo( nPos ) --> Nil

Parameters

nPos
NumericRequired

Valid physical number obtained through RecNo.

Return value

Nil; not a logical success indicator.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed333()
    Local nRecord
    If Select("EDTRB") > 0
        If !EDTRB->(Eof())
            nRecord := EDTRB->(RecNo())
            EDTRB->(DBGoTop())
            EDTRB->(DBGoTo(nRecord))
            ConOut(cValToChar(EDTRB->(RecNo()) == nRecord))
        EndIf
    EndIf
Return Nil
Expected result

True if the record stays valid during the fragment; no concurrent-change guarantee. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check RDD, alias and pending operations. Navigation can flush updates; preserve context under the caller contract and handle errors in the complete routine.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. DBGoTo. TDN. Accessed on 2026-10-26.
  2. TOTVS. DBSetFilter. TDN. Accessed on 2026-10-26.
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