Print Page | Close Window

> Date in IF Stmt

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21320
Printed Date: 29 Apr 2024 at 5:44am


Topic: > Date in IF Stmt
Posted By: BoltzGirl
Subject: > Date in IF Stmt
Date Posted: 28 Jan 2015 at 1:00pm
I am trying to pull in the following formula;
 
If isnull ({AM.SURG_DATE}) then "Blank"
else
if {AM.DISCH_DATE} > Date(2014,10,01)
then totext({AM.SURG_DATE})
 
Trying to say that is the SURG DATE is null, give me "Blank" and if the DISCH_DATE is greater than 10,01,2014 then give me the SURG_DATE.
 
So far all of this works, except for the > 10,01,2014 portion and I can't figure out why.
 
Just a newbie, but appreciate any help!Smile



Replies:
Posted By: Vimal Nair
Date Posted: 28 Jan 2015 at 6:37pm
Try This

If Isnull({AM.DISCH_DATE}) Then ""
Else
If Date(ToText({AM.DISCH_DATE},dd/MM/yyyy))>Date(2014,10,01) Then totext({AM.SURG_DATE})



-------------
Born To Live


Posted By: BoltzGirl
Date Posted: 29 Jan 2015 at 5:31am
Thank you so much Vimal!!  It got me thinking this morning it worked they way you suggested, then I realized I need it 'and' to cover both errors, since we highlight one as an error and need it to say "Blank" for the staff to see and correct....So I ended up with this!
 
If Isnull({AM.SURG_DATE})and Date(ToText({AM_.DISCH_DATE}))>Date(2014,10,01) Then "Blank"
Else totext({AM.SURG_DATE})
 
Works perfectly!



Print Page | Close Window