IsEmpty method

Official Content
This documentation is valid for:

Returns True if the value of a given attribute or variable is empty 1.

Syntax

Attribute | &Variable.IsEmpty()

Type Returned:
Boolean (True or False)

Scope

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

Description

Using the method with attributes will depend on whether the condition is evaluated on the Server (DBMS) or on the Client (Application Server). On the Client's side, if an attribute is null (or empty), the IsEmpty method returns true (in most situations, GeneXus handles nulls for attributes as expected). On the Server's side, only if the attribute is empty (not null), the IsEmpty method returns true.

Trailing blanks are ignored.

Samples

Case: Server's side evaluation

In this case, the condition is evaluated on the Server's side, so only empty values are retrieved.2

For each
    Where attribute.IsEmpty() // server side execution
          ...  // Only Empty attributes will be considered
EndFor

Case: Client's Side evaluation

This code is evaluated on the Client's side. Both null and empty values are retrieved.

For Each
    If attribute.IsEmpty() // client side execution
       ...   // Empty and Null attributes will be considered
    EndIf
EndFor

Notes:

1 Empty Value for each DBMS/Data Type

The following table shows the corresponding empty value for each data type and DBMS.

DBMS Numeric Date Datetime Character (n) Varchar Long Varchar Blob
SQL Server 0 1753-01-01 00:00:00.000 1753-01-01 00:00:00.000 n blanks <empty string> <empty string> <empty file>  
Oracle 0 0001-01-01 00:00:00 0001-01-01 00:00:00 n blanks 1 blank 1 blank <empty file>  
DB2 UDB 0 0001-01-01 0001-01-01 00:00:00.000 n blanks <empty string> <empty string> <empty file>  
DB2 iSeries 0 "00000000" or 0001-01-01(*) 0001-01-01-00.00.00 n blanks <empty string> <empty string> <empty file>  
MySQL 0 1000-01-01 1000-01-01 00:00:00 <empty string> <empty string> <empty string> <empty file>  
PostgreSQL 0 0001-01-01 0001-01-01 00:00:00 n blanks <empty string> <empty string> <empty file>  
Informix 0 0001-01-01 0001-01-01 00:00:00 n blanks <empty string> <empty string> <empty file>

2 Some "Where" conditions could be resolved on the Client's side.  This could happen when the navigation group (For Each, Data Provider, Grid) includes in their Where/Condition clause a function or method that can not be evaluated by the DBMS. In this case, a warning icon WarningIcon will be shown for that condition in the navigation list. Passing the mouse over it displays: "Constraint evaluated in the client. This may lead to poor performance"

See Also

Nullvalue function
IsNull function
Null function