Print Page | Close Window

HIde specific Date in Data Field

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
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=16299
Printed Date: 18 Apr 2025 at 7:13pm


Topic: HIde specific Date in Data Field
Posted By: thummel1
Subject: HIde specific Date in Data Field
Date Posted: 27 Apr 2012 at 4:40am
Hi,
I'm new to this site, so please bear with me as I learn the "techspeak" and such! In my Crystal Report (2008 version), I've been asked to "hide", or just make blank, whenever a specific date appears in a column. The Date is 1/1/1700. I thought I could write the following If Then Else statement to hide it:
If{EMPLOYEE.TERM_DATE}=#1/1/1700# then "" else "{EMPLOYEE.TERM_DATE}"
However, I get an error message that says the 'else' section of this statement needs to be a string, and I get it, it's because the 'then' is also a string. So the challenge. What's the best way to essentially hide all dates that appear like 1/1/1700? I'm hoping this is an easy question for more advanced Crystal users. Thanks!


-------------
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson



Replies:
Posted By: kevlray
Date Posted: 27 Apr 2012 at 5:20am
change the formula to this
if {EMPLOYEE.TERM_DATE}<>#1/1/1700#then  {EMPLOYEE.TERM_DATE}

That should eliminate having to convert the date to text.


Posted By: thummel1
Date Posted: 27 Apr 2012 at 7:00am
I tried this and, although I no longer get the error message, the date 1/1/1700 stays on the report. Also, when I added the Else "" at the end it still requires a date/time instead of a string. Stumped.

-------------
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson


Posted By: kevlray
Date Posted: 27 Apr 2012 at 8:24am
That is odd, I tried the code on one of my databases and it worked fine.  Did you create a formula for the column or are you trying to suppress the field (Format Field, Suppress)?


Posted By: thummel1
Date Posted: 27 Apr 2012 at 8:59am
I created the formula for the column and I do not want to suppress the field, just the dates that appear like 1/1/1700 in the field. So I would expect the example below that looks like:
01/28/2008
02/01/1996
1/1/1700
1/1/1700
12/15/2009
 
to appear like:
1/28/2008
02/01/1996
 
 
12/15/2009
 
 


-------------
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson


Posted By: kevlray
Date Posted: 27 Apr 2012 at 9:47am
When I used the formula above, those are basically the results I got.  I am not sure why it is not working for you.



Print Page | Close Window