KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Efficient Way to Count Records in Table
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: June 25, 2020

The command Records in table is useful when trying to find the number of records a table has. It may be tempting to find a count of records in a table using ALL RECORDS and Records in selection.

ALL RECORDS([Table])
$count:=Records in selection([Table])

However, it is recommended find this information through a single call with Records in table instead.

$count:=Records in table([Table])

Althogh these two methods provide the same results, the advantage of using Records in table is that it directly returns the amount of records in a given table. It does not perform a query and change the current selection like in the first example.