Branch and table sharing with xFilial
Builds keys using the branch appropriate to the queried table.
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)
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 + cStoreText 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.
- 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.

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