Official Content

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.




Objects: Procedure, Transaction, Web Panel
Generators: .NET, Java, Ruby (up to GeneXus X Evolution 3), RPG, Visual FoxPro (up to GeneXus X Evolution 3), Cobol


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

See Also

Null function
IsNull function

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant