KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: NULL values and Querying on programmatically created fields
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: June 29, 2010

With the 4D SQL Engine and SQL commands inside 4D it is possible to generate fields and tables via code. One aspect that you cannot access for fields created in this manner is the "Map NULL values to blank values" field property. You can find out more about that property in the Tech Tip Understanding "Map NULL values to blank values".

There are multiple ways that you can work around this problem in code. The command Is field value Null can be used to programmatically check for Null values in the given field. This can be combined with QUERY SELECTION BY FORMULA to find the Null values and you can then process them as necessary.

Another potential method to use is to disallow Null values for a given field. You can manage this when generating the field in your SQL code with constraints on the column. The column_definition page of the SQL Reference manual explains different settings for fields (columns) generated in SQL. One of the constraints available is NOT NULL which will deny Null values for the given field.