KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Retrieving the name of all tables into an array
PRODUCT: 4D | VERSION: 2003.1 | PLATFORM: Mac & Win
Published On: August 19, 2003

Versions 6.7 and 6.8 and 2003

The following is a simple method that populates an array with the name of the tables of a given database.

  ` Project Method: Table_List
  ` $1 - Pointer to a text or string array

C_POINTER($1)
C_BOOLEAN($ValidArrType)
C_LONGINT($tableMax;$vlTable)
$tableMax:=Count tables
$ValidArrType:=True
Case of
   : (Type($1->)=String array )
      ARRAY STRING(31;$1->;$tableMax)
   : (Type($1->)=Text array )
      ARRAY TEXT($1->;$tableMax)
   Else
      $ValidArrType:=False
End case
If ($ValidArrType)
   For ($vlTable;1;$tableMax)
      $1->{$vlTable}:=Table name($vlTable)
   End for
End if