Official Content

The way to represent the null value in cosmos DB is by using null (the null value is a supported value for the JSON format) or not instantiating in the JSON (see here for more information).
The second alternative (the undefined value) cannot be modeled in GeneXus.

Therefore, for handling nulls, you should use the SetNull method before inserting or updating data. As a result, the value will be inserted as a null JSON value.

Note: The Nullable property of the attribute must be set to Yes to allow storing null values.

Sample

new
    MagazineId = "Travel+Leisure"
    magazineTech = false
    MagazineName.SetNull()
endnew

image_20231614539_1_png

The IsNull function evaluated in the database will return only the records with a null value.

for each Magazines
where MagazineName.IsNull()

endfor

Evaluated on the client (that is, executing an if sentence inside the For Each loop), the IsEmpty method will also return true when it finds the null value because GeneXus cannot distinguish one from the other.

Handling empty values

By using the SetEmpty method, the empty value is saved (according to the data type of the attribute).

new
    MagazineId = "Food&Wine"
    magazineTech = false
    MagazineName.SetEmpty()
endnew

Asking for IsNULL on the client also returns the ​empty values. 

Scope

Generators: .NETJava

Availability

As since GeneXus 18 Upgrade 3.

 

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant