246
Views
4
Comments
Solved
How to check if a compound/entity datatype variable is null
Question
Application Type
Reactive
Service Studio Version
11.54.2 (Build 62176)

Basic question:  What is the correct expression to check if a compound data type variable is null. 

In my case I have local variable of an entity datatype):


Is the correct expression, for example:

If (UnlistedProjStaging=NullIdentifier(),...)? or should I perhaps look into the UnlistedProjStaging.ProjID key? 


Thank you.


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi,

There are a few Forge assets that allow you to compare entity record or objects.

You could create a local variable of the same data type and compare your record instantiation with it. If it is equal, than it contains all default (null) values.

https://www.outsystems.com/forge/component-overview/3756/entity-compare

Regards,

Daniel

2018-10-29 08-31-03
João Marques
 
MVP

Hi flowcooker,


There are a few Null identifiers, depending on the type of the value you are comparing it to, which you can check by clicking the null dropdown:


In case it is an integer / long integer id, you compare it to NullIdentifier(), if it is a text you compare it to NullTextIdentifier() and so on.


To check if the record is null, for instance when you do a With or Without join (or Left Join) with an entity and want to see if there are matches, usually the id of the table is used in the null comparison.


Kind Regards,
João

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi,

There are a few Forge assets that allow you to compare entity record or objects.

You could create a local variable of the same data type and compare your record instantiation with it. If it is equal, than it contains all default (null) values.

https://www.outsystems.com/forge/component-overview/3756/entity-compare

Regards,

Daniel

UserImage.jpg
flowcooker

Thank you, all. I wish I could have marked all of your responses as solutions. Since my employer doesn't allow us to install Forge Assets without their extensive vetting, I implemented @Daniel Kuhlmann's solution today of the local variable comparison. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.