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)

Description

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

Trailing blanks are ignored.

Example

Case: Server Side evaluation

In this case, the condition is evaluated by the server 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 Side evaluation

This code is evaluated at the client 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 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"

Scope

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

Nullvalue Function
IsNull Function
Null Function


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.