Official Content

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

Syntax

Attribute | &Variable.IsEmpty()

Type Returned:
Boolean

Scope

Data Types: Audio, Blob, BlobFile, Boolean Character, VarCharLongVarCharDate, DateTime Geography, GeoLine, GeoPoint, GeoPolygon, GUID, Image, Numeric, Video
Generators: .NET, .NET Framework, Java, RPG,  Cobol, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

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), this 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.

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>

Samples

Example 1: Server's side evaluation

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

For each
    Where attribute.IsEmpty() // server side execution
          ...  // Only Empty attributes will be considered
EndFor
Note: 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"

 

Example 2:  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

 

See Also

Nullvalue function
IsNull function
Null function




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