4D v16.3

Get last table number

Home

 
4D v16.3
Get last table number

Get last table number 


 

Get last table number -> Function result 
Parameter Type   Description
Function result  Longint in Highest table number in the database

Get last table number returns the highest table number among the tables in the database. Tables are numbered in the order in which they are created. If no table has been deleted from the database, this command then returns the number of tables present in the database. In the case of repeated loops on the table numbers of the database, you must use the Is table number valid command in order to check that the table has not been deleted.

Example  

The following example builds an array, named asTables, with the names of tables defined in the database. This array can be used as a drop-down list (or tab control, scrollable area, and so on) to display the list of the tables, within a form:

 ARRAY STRING(31;asTables;Get last table number)
 If(Get last table number>0) `If the database does contain tables
    For($vlTables;Size of array(asTables);1;-1)
       If(Is table number valid($vlTables))
          asTables{$vlTables}:=Table name($vlTables)
       Else
          DELETE FROM ARRAY(asTables;$vlTables)
       End if
    End for
 End if



See also 

Get last field number
Is table number valid
Table name

 
PROPERTIES 

Product: 4D
Theme: Structure Access
Number: 254

This command can be run in preemptive processes

 
HISTORY 

Modified: 4D v11 SQL

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)