Print Page | Close Window

If date is empty then enter text

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21743
Printed Date: 29 Apr 2024 at 12:33am


Topic: If date is empty then enter text
Posted By: shabbaranks
Subject: If date is empty then enter text
Date Posted: 22 Oct 2015 at 11:11pm
Hi,

Im trying to get my formula to enter text if a date field is empty. It works fine if I have 2 separate formulas but ideally I would like to combine it to one - any ideas where Im going wrong please?

if isnull({Source.Last_Recv_Date}) then "Not Recieved" else cdate({Source.Last_Recv_Date})

Thanks as always



Replies:
Posted By: DBlank
Date Posted: 23 Oct 2015 at 2:59am
is your field text or or a datetime field?
your result from the formula has to be of a single datatype so you cannot mix it to be text in one case and a date in the other (cdate). Assuming the original field is a date or datetime type just format the result as a string to look like a date

if isnull({Source.Last_Recv_Date}) then 'Not Received' else totext({Source.Last_Recv_Date},'MM/dd/yyyy')



Print Page | Close Window