FCount
FCount() --> nRetCounts work-area fields rather than records.
Overview
FCount inspects active-area structure and returns the field count. It does not count records and does not replace LastRec. The community source selects SA1 first; the adaptation explicitly qualifies the owned table rather than selecting a caller area to inspect metadata. 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)
Syntax
FCount() --> nRetReturn value
Number of fields in the structure.
Commented example
#Include "Protheus.ch"
User Function Ed379()
// Inspect metadata without visiting records.
If Select("EDTRB") > 0
ConOut(cValToChar(EDTRB->(FCount())))
EndIf
Return NilCount according to EDTRB schema; no row count. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- 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.

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