Official Content

Determines if an attribute's value is DBMS NULL.

Syntax

Attribute.IsNull()

Where:
Attribute
   Is the attribute that will be evaluated.

Type Returned:
Boolean

Scope

Objects: ProcedureData Provider, Transaction, Web PanelPanel
Generators: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

In some cases, it is necessary to determine if an attribute's value matches the DBMS NULL. This value is different from the nullvalue (obtained, for example, using the Nullvalue (Attribute) function), determined by GeneXus according to the data/DBMS type. 

The NULL value of an attribute could have been generated, for example, if the attribute has not been instanced in a New command (with the “Initialize not referenced attributes” preference set to “No”). It may also be necessary to distinguish it from other values when external tables are accessed. 
When the method is used by including it in Where or Condition commands that are optimized (which means the condition is solved in the server), it will be translated as...Attribute IS NULL in the SQL statement.

Notes:

  • This method can only be used within For Each and Condition commands of Grids that have a base table. 
  • For local DBMSs (Access and DBFs) the IsNull() method behaves in the same way as the Null() function.

Samples

Sample 1

For each
    Where CustomerName.IsNull()
       ...   ...
       ...   ...
EndFor

This For Each command navigates through all the Customer records that have the CustomerName attribute with a DBMS NULL value.

Sample 2

For each
    If CustomerName.IsNull()
       ...
    EndIf
    ...
    ...
EndFor

Even though both samples return the same results, the first one is more efficient, as the condition is solved in the server whereas the second one is solved in the client.

See Also

IsNull function
Null function
Nullvalue function


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