Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF statement for null values 1

Status
Not open for further replies.

Scroller52

Technical User
Jan 25, 2008
102
US
i'm using CR XI release 2 on a SQL DB.

for a field 'termination date', if the field is null, then i would like crystal to say "N/A" else 'termination date'

so my formula is this:
if isnull({Position.Termination Date}) then "N/A"
else {Position.Termination Date}

but i get an error saying that the else should return a string. i'm guessing that since the N/A is a string, and the termination date is a date field, there are data type complications. is there a way to get around this?
 
You can use totext or cstr.

if isnull({Position.Termination Date}) then "N/A"
else totext({Position.Termination Date},"dd/MM/yyyy")

-lw
 
thanks kskid! that worked perfectly, i knew it was a datatype issue, just didn't know how the solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top