Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Found

Found() --> lRet

Checks the last seek result.

FoundAdvPL
01 · OVERVIEW

Overview

Found reports the last seek outcome without performing another lookup or proving cursor validity for every later read. The example requires an active order whose expression is length-10 ED_COD and seeks fictional key A padded to that length. Found is checked immediately in the same context without an intervening seek. It neither searches a standard business table nor guarantees the key exists. EDTRB is an already-open owned test alias; ED_COD, when used, is a length-10 character field in the teaching schema. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

Found() --> lRet

Return value

Logical success of the last seek.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed390()
    Local lSeek
    Local lLast
    // Owned EDTRB; active length-10 ED_COD order.
    If Select("EDTRB") > 0
        lSeek := EDTRB->(DBSeek(PadR("A",10), .F.))
        lLast := EDTRB->(Found())
        ConOut(cValToChar(lSeek))
        ConOut(cValToChar(lLast))
    EndIf
Return Nil
Expected result

Two indicators for the just-completed seek, depending on data; alias position changes. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Use only an owned test table with known schema. Qualify the alias, check record position and manage context changes under the caller contract.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Found. 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