KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method that validates the existence of a table or a field from a name
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: July 11, 2022

The following method utilizes the 4D datastore to provide a simple way to validate the existence of a table or a field based on the name.

#DECLARE($tableName : Text; $fieldName : Text)->$valid : Boolean
Case of
  : (Count parameters=2)
    $valid:=(ds[$tableName][$fieldName]#Null)
  : (Count parameters=1)
    $valid:=(ds[$tableName]#Null)
  Else
    $valid:=False
End case