Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Branch and table sharing with xFilial

Builds keys using the branch appropriate to the queried table.

Branch and table sharing with xFilialAdvPL
01 · OVERVIEW

Overview

xFilial follows the specified alias sharing mode. The result can be blank and differ from the login branch; cFilAnt is not a universal key prefix. Before seeking, check index expression and each segment width. This fragment only builds a key assuming Branch+Code+Store and caller-formatted cCode/cStore. It assumes no order number and performs no DBSeek. It does not change dictionary sharing. (TOTVS, n.d., refs. 1–2)

03 · PRACTICAL EXAMPLE

Commented example

// Fragment: only if the index expression is Branch+Code+Store.
// cCode and cStore already have the required width and format.
cKey := xFilial("SA1") + cCode + cStore
Expected result

Text key in the prepared context without lookup or write. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Review each alias separately; do not duplicate branch prefixes in APIs that already handle them, such as documented ExistCpo/ExistChav validation.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. XFILIAL(). TDN. Accessed on 2026-10-26.
  2. TOTVS. DBSeek. 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