| 4D v18Get last table number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v18
 Get last table number 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Get last table number -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| Function result | Longint |   | 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.
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
	Product:  4D
	Theme:  Structure Access
	Number:  
        254
        
        
        
	
	Modified:  4D v11 SQL  
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	4D Language Reference ( 4D v18)
	
	
	
	
	
 Add a comment
Add a comment