New type supported by 4D: Null

4D introduces a new Null type to ease the management of objects and collections. Thanks to the null value, you can represent a missing value and easily verify if your object or collection is correctly set.

The null type represents an unknown or a missing value.This type is special because it is impossible to cast to the null type or declare a variable of this type and it can be used just with object, collection, pointer and picture variables.

Be careful not to confuse the null value with an empty string or an integer with 0 for example, since 0 or “” are values.

Null is very useful in the case of a collection. Let’s examine a concrete example: since the the collection elements are not typed by default, it ain’t possible for 4D to set the elements with default values. No panic; Null value to the rescue!

$c:=New collection

How to set a null value?

You can simply use the new command: Null

$o:=New object

How to test null Values?

You can test null values with the Null command: 

If ($o.quantity=Null)
  ALERT("Please enter a quantity")
end if

Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.