Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

DBSetFilter

DBSetFilter( bCond, cCond ) --> Nil

Defines a visibility condition for the work area.

DBSetFilterAdvPL
01 · OVERVIEW

Overview

DBSetFilter accepts equivalent logical block and text expressions. It does not immediately reposition: DBGoTop navigates under the filter. DBGoTo can physically reach records outside it, so a filter is not authorization enforcement. The demonstration requires character ED_COD on the owned table and leaves filter/position changed; a complete routine must manage that state. 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

DBSetFilter( bCond, cCond ) --> Nil

Parameters

bCond
Code blockRequired

Block returning a logical value for each record.

cCond
CharacterRequired

Expression equivalent to the block.

Return value

Nil; not a logical success indicator.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed337()
    // ED_COD must be a character field in the owned table.
    If Select("EDTRB") > 0
        EDTRB->(DBSetFilter({|| ED_COD == "A"}, "ED_COD == 'A'"))
        EDTRB->(DBGoTop())
        ConOut(cValToChar(!EDTRB->(Eof())))
    EndIf
Return Nil
Expected result

Reports whether a record with the fictional code is visible; data-dependent. 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. 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