Condividi tramite


RECCOUNT( ) Function

Returns the number of records in the current or specified table.

RECCOUNT([nWorkArea | cTableAlias])

Return Values

Numeric

Parameters

  • nWorkArea
    Specifies the work area number for a table open in another work area.

    RECCOUNT( ) returns 0 if a table isn't open in the work area you specify.

  • cTableAlias
    Specifies the table alias for a table open in another work area.

Remarks

The value RECCOUNT( ) returns isn't affected by SET DELETED and SET FILTER.

RECCOUNT( ) without the optional arguments nWorkArea or cTableAlias returns the number of records in the table in the currently selected work area.

Example

In the following example, Microsoft Visual FoxPro compares the available disk space with the amount needed to sort customer.

** Check DISKSPACE before a SORT **

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table

** Get size of table header **

gnTableHead = HEADER( )

** Calculate size of table **

gnFileSize = gnTableHead + (RECSIZE( ) * RECCOUNT( ) + 1)
IF DISKSPACE( ) > (gnFileSize * 3)
   WAIT WINDOW 'Sufficient diskspace to sort.'
ELSE
   WAIT WINDOW 'Insufficient diskspace. Sort cannot be done.'
ENDIF

See Also

RECNO( ) | RECSIZE( ) | SET DELETED | SET FILTER