nulltextIdentifier
Question

Hi Team,

Can you please provide difference between nulltextIdentifier and "" on text fields and similar to integer0 and nullIdentifier,which one to choose.


Regards

Hi Ujwala,

I found this interesting topic talking about NullTextIdentifier you can take a look.

Cheers,

Khuong

mvp_badge
MVP

Good call @Khuong Truong , the best practices written in that post by MVP @Jorge Martins I fully agree upon.

mvp_badge
MVP
Solution

Hi ujwala,

As described in  this topic  by  @Jorge Martins a very experienced OutSystems MVP and trainer, please follow the following simple rules to stay out of trouble:

  • If you want to check if a Text variable is the empty string, compare it with "".
  • If you want to check if an Integer/Long Integer is 0, compare it with 0.
  • If you want to check if a Text Identifier variable does not have any meaningful value (corresponding to the NULL concept of the databases and memory allocation), compare it with NullTextIdentifier()
  • If you want to check if an Identifier variable does not have any meaningful value, compare it with NullIdentifier()

Regards,

Daniel

mvp_badge
MVP

Hi Ujwala,


Indeed, there is no difference between "" and NullTextIdentifier(), just because when a string is empty, it is "".

From a thinking standpoint, in those situations you want to check if the fields are null and in those cases it is more natural to use the NullTextIdentifier(), the NullIdentifier() and the NullDate() functions.


Kind Regards,
João

Hi Ujwala,

I found this interesting topic talking about NullTextIdentifier you can take a look.

Cheers,

Khuong

mvp_badge
MVP

Good call @Khuong Truong , the best practices written in that post by MVP @Jorge Martins I fully agree upon.

Hi,

Actually, there is no different. BTW, NullTextIdentifier() is to compare the TextIdentifier value and "" is to compare the text value. So we should follow the guid to use this. 

If one day, the system changes the default null value for TextIdentifier, the code we use NullTextIdentifier() to compare can still work, but the code we use "" to compare should get errors.

Hi,


Can you please provide some example to get clarified.

Thank you


mvp_badge
MVP
Solution

Hi ujwala,

As described in  this topic  by  @Jorge Martins a very experienced OutSystems MVP and trainer, please follow the following simple rules to stay out of trouble:

  • If you want to check if a Text variable is the empty string, compare it with "".
  • If you want to check if an Integer/Long Integer is 0, compare it with 0.
  • If you want to check if a Text Identifier variable does not have any meaningful value (corresponding to the NULL concept of the databases and memory allocation), compare it with NullTextIdentifier()
  • If you want to check if an Identifier variable does not have any meaningful value, compare it with NullIdentifier()

Regards,

Daniel

Hi Daniel,

Thank you ,but as in db tables view datawise we see 0 and blank values for integer and text based variables,so when we compare textidentiefier variable ex.addressId!=nulltextidentifier means comparing same as addressId!=null -is it the case ,also if database directly place 0 and blank for all the variables integer and text based then does that mean only this is applicable for identifiers only 

mvp_badge
MVP

Isn't your question answered by the last to bullets of my previous reply?




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