SetNull Method

Official Content
This documentation is valid for:

This method allows loading a null value in an attribute, and enables independence from the Generate null for nullvalue() property used in assigning a null value attribute.




If the attribute allows nulls in the table, using this method can force the attribute to take the null value.

The SetNull method is applied as follows:

  • Attributes. The attribute must accept nulls (Nullable property = Yes)
  • Variables based on BC. The associated attribute must accept nulls (Nullable property = Yes)
  • Variables based on SDT, for example, to stop recursion.


Case to Recursive SDTs:

If you define an 'Employee' SDT with a 'Manager' member of the type 'Employee', to stop recursion you have to program &Person.Manager.SetNull().

Before referring to the manager, ask if &Employee.Manager.Isnull(). If you do not program this line, the Manager is automatically initiated.

Employee SDT

&Employee.Id = 99
&Employee.Name = 'Mary Shelley'
&Employee.Manager.Id  = 69
&Employee.Manager.Name  = 'Er'

Programming is the same as in previous versions, plus IsNull() and SetNull() handling.

The result is the following:

Other examples:
OwnerCel.SetNull() if OwnerName.IsEmpty();
If Y.IsNull()
   X = Y


Objects: Procedures, Transactions, Web Panels
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), RPG, Visual FoxPro (up to GeneXus X Evolution 3), Cobol

See Also

Null Function
IsNull Function