Nullvalue Function

Official Content
This documentation is valid for:

Retrieves the “null” value of an attribute or variable. That value may be empty or the Null itself, depending on the context where the function is used.

Syntax

Nullvalue(attribute | &variable)

Scope

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

Description

It can be used in assignments and conditions with slightly different results:

Assignments

  • To assign an empty value to an attribute or set it as Null. It depends on the Generate null for nullvalue() property.  
  • To avoid the property dependence use the SetNull() or SetEmpty() methods.
  • To initialize variables with their empty value.

Conditions

  • Using the function with variables means that the corresponding empty value will be considered.
  • Using the function with attributes will depend on whether the condition is evaluated on the server or the client.

Samples

For Each
     Where Att = Nullvalue(Att)
EndFor

In this case the For Each considers those records with an empty ATT.

For Each
     If Att = Nullvalue(Att)
        ....
     EndIf
EndFor

In this case the For Each retrieves records where Att is empty or Null.

Note that in this case the function does not take into account the Generate null for nullvalue() property.

If nullvalue is assigned to an attribute in a Data Provider, it will set an empty value instead of null.

See Also

Null Function
IsNull Function
SetNull Method