Nulls in Form behavior property

Official Content
This documentation is valid for:
When inserting values in a Transaction Form and a field is left with no value set, should this be considered as a NULL value or as an Empty one? This ambiguous situation can be solved with the Nulls in Forms behavior attribute's property. It allows specifying, at design time, which "value" (null or empty) will be stored when the user leaves empty the attribute's control field in the Transaction UI.


Blank as Null Will save NULL in database only when the value is blank. When value saved is NULL it will show no value (blank) and when is 0 will show 0.
No Nulls
Empty as Null Will save NULL if value is 0 or left blank, always show 0 if value saved is 0 or NULL (Default value)


Available at the Data Store.
Objects: Transaction
Platforms: Web(.Net, Java)


This Nulls in Form behavior property can be set at attribute and/or attribute's control level, and specify whether an empty value of the control must be considered as null or not.

If the property is set at the attribute level, the value is inherited by all controls where the attribute is accepted and it can take the null value. Otherwise, the property is ignored.

Setting the property as Empty as Null is the same as specifying the following rule in the Transaction:

Att.SetNull() If Att.IsEmpty()

Setting the property as Blank as Null will save Null only when the field is empty (blank), if inputs an empty value (0) it will save a 0 in the database.

The property Empty as Null does not apply to Business Components. When the property is set to True, you can get the same behavior in Business Components by adding the rule:

AttId.SetNull() if AttId.IsEmpty();


Imagine the example of Customer and Invoice Transactions. We specify the Empty as Null property in Yes for CustomerId. This property does not apply to the Customer Transaction because CustomerId comprises the primary key and therefore does not allow nulls. However, in the Invoice Transaction the CustomerId can take null value (if Null property = Yes) and if no value is specified in the Transaction form, or the empty one is assigned (i.e. cero if CustomerId is Numeric), the Null will be "stored".

How to apply changes

To apply the corresponding changes when the property value is configured, execute a Rebuild All.


This property is implemented at the KB (Version) level to keep backward compatibility for those Knowledge Bases that come from previous versions of GeneXus 9.0. The property is Empty as null behavior. Possible values are: Current Version Version 8.0 and prior (Deprecated) Default value for new Knowledge Bases: Current Version Default value for converted Knowledge Bases: Version 8.0 and prior (Deprecated) If the property Empty as null behavior is set to Version 8.0 and prior, a new value, Compatible, is also displayed in the Empty as Null attribute/control property. This is the default value if the Knowledge Base comes from previous versions to ensure the compatibility. What does the "Compatible" value means? Until GeneXus 8.0, when the user has left the attribute field without values in the Transaction form, the empty value were inserted. So, this is the behavior in the case of the "Compatible" property value.

See Also

Handling Nulls with GeneXus