Official Content

Assigns the empty value in an attribute, variable, or business component depending on its types.

Syntax

AttributeName | &VarName.SetEmpty()

Where:

AttributeName
   
Is the Attribute name to which the method is applied.

&VarName
   
Is the Variable name to which the method is applied.

Scope

Data Types: AudioBlobBlobFileCharacterVarCharLongVarChar Date Date, DateTime Geography, GeoLine, GeoPoint, GeoPolygon, GUIDImageNumericVideoExtended data types
Generators: .NET, .NET Framework, Java, RPG, Cobol, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

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

Data Type Empty value
Boolean False
Character(N), VarChar(N), LongVarChar(N)   N-blanks
Date 001-01-01
DateTime 0001-01-01 00:00:00
Numeric 0.0
Time 00:00:00

Samples

Rule defined in an Owner Transaction object:

OwnerCel.SetEmpty() if OwnerName.IsEmpty();


Code defined inside a Procedure Source or inside an object Event:

If OwnerName.IsEmpty()
   OwnerCel.SetEmpty()
EndIf


Notes:

  • Since GeneXus 15 Upgrade 9, Apple offline apps will consider Date/DateTime empty value as 0001-01-01 instead of 1970-01-01. In case you use an empty value for displaying data, those records with the old empty date value (1970-01-01) will start to be displayed. The following offline Procedure script will fix the problem in the Offline Database:
    &oldEmptyDate = ymdtod(1970,1,1)
    For each
        where DocumentDate = &oldEmptyDate
          DocumentDate.SetEmpty()
    endfor
    commit
  • Since GeneXus 16 upgrade 2, this method can be used in Client-side Events in Native Mobile Applications for Apple.

See Also

Attribute Empty Value for each DBMS and Data Type
Nullvalue function
IsNull function

   


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