cancel
Showing results for 
Search instead for 
Did you mean: 

Replace NULL value with text

former_member406941
Participant
0 Kudos

Hi!

Trying to replace a null value with text.  Here's what I have, not working though..

If  (isnull({DB.Field.1})

or ({DB.Field.1} ='')) then "VOID"

else

       {DB.Field.1}

Maybe it's not working because the {DB.Field.1} is a date/time, i.e.:   4/11/16

?

Thanks!

Rich

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Rich,

Try changing the code to:

If  (isnull({DB.Field.1})

or ({DB.Field.1} = cdate(0,0,0))) then "VOID"

else

       {DB.Field.1}


-Abhilash

former_member406941
Participant
0 Kudos

Thanks for the reply, Abhilash!  I get "A string is required here" message and it highlights the {DB.Field.1} after ELSE

abhilash_kumar
Active Contributor
0 Kudos

In the else part, replace {Db.field1} with

Totext({Db.field1}, 'MM/dd/yyyy')

If you need another date format, just search for the totext function in CR's help and it should list all available date conversion formats.

-Abhilash

former_member406941
Participant
0 Kudos

Ok, here's what I now have:

If  (isnull({Db.field1}) or ({Db.field1} ='')) then

       totext "VOID"

else

       Totext({Db.field1}, 'MM/dd/yyyy'

I'm getting this error:  "The remaining text does not appear to be part of the formula", and it highlights

"VOID"

else

       Totext({Db.field1}, 'MM/dd/yyyy'

abhilash_kumar
Active Contributor
0 Kudos

Rich,

This is what the formula should look like:

If  (isnull({DB.Field.1})

or ({DB.Field.1} = cdate(0,0,0))) then "VOID"

else

       Totext({DB.Field.1}, 'MM/dd/yyyy')


-Abhilash

Answers (0)