Página 1 de 1

Como saber o numero de colunas de um DBF ?

Enviado: 29 Mai 2014 11:02
por bencz
Como posso fazer, para saber o numero de colunas de um DBF ?

Como saber o numero de colunas de um DBF ?

Enviado: 29 Mai 2014 11:16
por SandroBelarmino
Você pode usar a função FCOUNT() , ela retorna o numero de campos do dbf em uso.

Como saber o numero de colunas de um DBF ?

Enviado: 29 Mai 2014 11:20
por SandroBelarmino
Abaixo todo o descritivo que consta no NG.
FCOUNT()
Return the number of fields in the current .dbf file


--------------------------------------------------------------------------------

Syntax

FCOUNT() --> nFields

Returns

FCOUNT() returns the number of fields in the database file in the
current work area as an integer numeric value. If there is no database
file open, FCOUNT() returns zero.

Description

FCOUNT() is a database function. It is useful in applications
containing data-independent programs that can operate on any database
file. These include generalized import/export and reporting programs.
Typically, you use FCOUNT() to establish the upper limit of a FOR...NEXT
or DO WHILE loop that processes a single field at a time.

By default, FCOUNT() operates on the currently selected work area.

Examples

• This example illustrates FCOUNT(), returning the number of
fields in the current and an unselected work area:

USE Sales NEW
USE Customer NEW
? FCOUNT() // Result: 5
? Sales->(FCOUNT()) // Result: 8

• This example uses FCOUNT() to DECLARE an array with field
information:

LOCAL aFields := ARRAY(FCOUNT())
AFIELDS(aFields)

• This example uses FCOUNT() as the upper boundary of a FOR loop
that processes the list of current work area fields:

LOCAL nField
USE Sales NEW
FOR nField := 1 TO FCOUNT()
? FIELD(nField)
NEXT

Files Library is CLIPPER.LIB.

See also:
• AFIELDS()
• FIELDNAME()
• TYPE()

Como saber o numero de colunas de um DBF ?

Enviado: 29 Mai 2014 11:30
por bencz
Blz ;)
Funcionou, muito obrigado!!!