KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 3 ways to find address table size
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: December 11, 2023

This tech tip will go over 3 ways to find the size of the address table for a specific database table.

1) Using the Maintenance & Security Center (MSC) Window

Open up the MSC window for your database, and the Information page should be displayed. Click on the Tables tab toward the top of the page; a table will be displayed shocasing, information of all of the tables in your database. The very last column, Address Table Size, will immediately tell you the actual size of an address table.



2) Using ALL RECORDS command

You can programmatically retrieve the address table size by using the code snippet below:

// declare variable
var $addressTableSize : Integer

// get size of address table
ALL RECORDS([Contacts])
LAST RECORD([Contacts])
$addressTableSize:=Record number([Contacts])+1 // add 1, since index starts at 0

If you just want the address table size, this is the fastest way to do so. Please note that this is different from using the Records in Table command, which yields the number of existing records in the table.


3) Using the Create Set command
Of the 3 ways to find the address table size, this is the least efficient in terms of performance and space; however, using a allows you to also gather more information on deleted records.
  • The resulting boolean array will pinpoint exactly which records have been deleted.

  • You can count the total number of deleted records using $countDeleted:=count in array($bArray;false)

To get the size of the address table using the Create Set command, you can use the code snippet below:
// declare variables
ARRAY BOOLEAN($bArray; 0)
var $addressTableSize : Integer

// get size of address table
ALL RECORDS([Contacts])
CREATE SET([Contacts]; "someSet")
BOOLEAN ARRAY FROM SET($bArray; "someSet")
$addressTableSize:=Size of array($bArray)+1 // add 1, since index starts at 0
CLEAR SET("someSet")