function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
satheeshrsksatheeshrsk 

how to test blank value for Integer

Hi All,

 

Is there any way to test blank values for Integer fileds, for Strings fields

if( Str == '') or Isblank(Str) ...

Any help must be highly appreciated.

Thanks in advance !



Salesforce Hidden FactsSalesforce Hidden Facts
You can convert the integer value to string value by Using String.ValueOf function
and after that test this converted string for blank value as you are doing .
chiranjeevitgchiranjeevitg

you can check like this for integer

 

integer i;

if(i==null)

 

 

satheeshrsksatheeshrsk
Thank you for the work around. Is there any standard methods ?
satheeshrsksatheeshrsk

Thank you for the response   . It is checking only null values, not blanks

chiranjeevitgchiranjeevitg

are using in apex or formulas?

chiranjeevitgchiranjeevitg

can yoy try this

 

if(i==null || i=='')

satheeshrsksatheeshrsk
I am using in Apex only , and i == '' giving compilation Error
chiranjeevitgchiranjeevitg

we cannot use i==''. As this is for string literals.

 

 

DipakDipak
Integer Type data can only contains NULL value , if there is no Data.
because NULL is the default value of a String. There is no standard method to check ''(blank) value for Integer field.

If you need it , then you can check

Intege i;
........
.......
If(i == NULL || (i != NULL && String.isBlank(String.valueOf(i)))){
.......
.....
}