Is field number valid
Is field number valid ( tablePtr : Pointer ; fieldNum : Integer ) : Boolean
Is field number valid ( tableNum : Integer ; fieldNum : Integer ) : Boolean
| Parameter | Type | Description | |
|---|---|---|---|
| tableNum | Integer | → | Table number |
| tablePtr | Pointer | → | Pointer to table |
| fieldNum | Integer | → | Field number |
| Function result | Boolean | ← | True = field exists in the table False = field does not exist in the table |
History
| Release | Changes |
|---|---|
| 11 SQL | Created |
Description
The Is field number valid command returns True if the field whose number is passed in the fieldNum parameter exists in the table whose number or pointer is passed in the tableNum or tablePtr parameter. If the field does not exist, the command returns False. Keep in mind that the command returns False if the table containing the field is in the Trash of the Explorer.
This command can be used to detect any field deletions, which create gaps in the sequence of field numbers.
Example
It is possible to delete 4D tables and fields. You must take this possibility into account in algorithms used for counting tables and fields. It is necessary to use algorithms combining the Get last table number and Get last field number, as well as Is table number valid and Is field number valid commands. The following is an example of this type of algorithm:
var $thetable; $thefield : Integer
For($thetable;1;Get last table number)
If(Is table number valid($thetable))
For($thefield;1;Get last field number($thetable))
If(Is field number valid($thetable;$thefield))
... `The field exists and is valid
End if
End for
End if
End for
See also
Last table number
Is table number valid
Properties
| Command number | 1000 |
| Thread safe | yes |