cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a Default value for null?

01-26-2016 11:28 PM
4015 views 6 comments
0 Likes
SAP Managed Tags
Subscribe

I have these fields that sometimes return null values and I want to write something when they are null.

So I wrote this formula in the display string of the format editor for the field

if ISNULL({client_updates.client_notes}) then "There is not comment"

else {client_updates.client_notes}

I get no error on it but it returns nothing. There is still a blank field. I've tried clicking Convert Database null values to default in report options or in the formula editor changing from exceptions for nulls to default value for null and then changing my formula to say

if  {client_updates.client_notes} = "0" then "There is not comment"

else {client_updates.client_notes}

But I still get blank fields.

I don't know if it helps but no matter what I try I still get the correct value returned when it is not null so that's working.

What am i doing wrong?

Thanks

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Likes

Hi Kurt,

In the formula editor select 'Default Values for Nulls' and then modify the code to:

if  {client_updates.client_notes} = '' then "There is not comment"

else {client_updates.client_notes}

-Abhilash

Former Member
0 Likes

It's still giving me a blank field.

DellSC
Active Contributor
0 Likes

It could be that the field has one or more blank spaces in it instead of actually being null.  With "Default Values for Nulls' turned on, try this:

if  Trim({client_updates.client_notes}) = '' then "There is not comment"

else {client_updates.client_notes

-Dell

Former Member
0 Likes

Still blank. It is a whole field of comments that I'm trying to do this with. Does that make a difference?

abhilash_kumar
Active Contributor
0 Likes

Hi Kurt,

What do you mean by 'whole field'?

-Abhilash

Former Member
0 Likes

The field is varying lengths of comments sometimes formatted differently.

So sometimes it's "This is the comment written."

Sometimes it's "This is one of three comments.


                         This is one of three comments.


                         This is one of three comments. "