Returning the number of records in a Sculptor keyed fileΒΆ

record_count()

Return the number of records in a Sculptor keyed file


SYNTAX

record_count(file_id | [file_id.]index_id | pathname)

Returns the number of records in a Sculptor keyed file or secondary index.

file_id

A Sculptor keyed file declared in the program. The file must be open. If it is closed no error is generated but the function returns zero.

[file_id.]index_id

A secondary index (defined by the ddeditor program) for a Sculptor keyed file declared in the program. The file_id need not be specified if the index_id is unique within the program. The file must be open. If it is closed no error is generated but the function returns zero.

pathname

The path of the Sculptor keyed file. This feature enables the function to be used on files not declared in the program. Either the path of the data file (no extension) or of the index file (.k extension) may be used. The path cannot be a secondary index. To count records in a secondary index, the [file_id.]index_id must be specified.

This function is fast with files that have a data file, unless they have a large number of deleted records that have not been reused. The function is slower on index only files, because each index block must be read.

The kfcopy utility can be used to remove deleted records from a Sculptor keyed file.

This function works with ODBC databases, but its efficiency depends on the underlying database engine.


EXAMPLE

!temp NumRecs,,i4

     +textbox NRecsBox at 312,32 {
          field = tmp.NumRecs
          label = "Records "
          format = "#######"
          style = WS_NOTABSTOP
          tooltip = "Number of records in the file"
        }

     NumRecs = record_count(FullKFPath)
     display NRecsBox

RELATED TOPICS

Sculptor keyed files

Secondary indexes

ODBC