Print Page | Close Window

Show dates greater than Current date

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=3943
Printed Date: 03 May 2024 at 4:46pm


Topic: Show dates greater than Current date
Posted By: ashisahb
Subject: Show dates greater than Current date
Date Posted: 09 Aug 2008 at 4:56am
Hi ,
 
I have a column in a report which is consisting of different dates.I need only those dates to be visible which are greater than or equal to current date,rest of the fields in that column should come as blank.
 
Any help appreciated.
 
Thanks,
Ashish.


-------------
Regards,
Ashish



Replies:
Posted By: BrianBischof
Date Posted: 09 Aug 2008 at 12:32pm
You can use the built-in function 'CurrentDate' to get today's date and use that in your record selection formula.
 
I have all the CR date-time functions fully documented in chapter 6 of my Encyclopedia book. You can find out more about my books at http://www.amazon.com/exec/obidos/ASIN/0974953601/bischofsystem-20 - Amazon.com or reading the http://members.crystalreportsbook.com - Crystal Reports eBooks online.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 4:51am
Thanks for the reply.
 
but i am still having the issue.
 
I am using the following formula:
 
if(isnull({cp.pendingSettlementDate})) then
totext(" ")
else if ((totext({cp.pendingSettlementDate})>(totext(CurrentDate)))then
totext({cp.pendingSettlementDate})
 
but its not working.Can you provide me the exact formula.
 cp.pendingSettlementDate is the field i am having data.


-------------
Regards,
Ashish


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 5:09am
Hi
 
Are you getting errors ? what is not working can you let us know?...
 
in the meantime............
 
In your record selection formula try this
 
cp.pendingSettlementDate >= currentdate  which will filter all the records which have  less then current date.
 
or
 
for column
 
Create formula frm
 
if isnull({cp.pendingSettlementDate}) then
""
else if
totext ({cp.pendingSettlementDate})>  totext(currentdate) then
totext({cp.pendingSettlementDate})
 
or
try this
 
if {cp.pendingSettlementDate} >  currentdate then
{cp.pendingSettlementDate}
 
Cheers
Rahul


Posted By: themessenger
Date Posted: 15 Aug 2008 at 6:09am
Why using ToText on the logic test?

Does:

if(isnull({cp.pendingSettlementDate})) then
totext(" ")
else if ({cp.pendingSettlementDate}>(CurrentDate))then
totext({cp.pendingSettlementDate})


not work?


-------------
Managing Director
www.allmymenus.com


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 6:16am

Hi ,

i dont want to filter all the rows , just want to suppress the rows which are greater than or equal to current date.
 
i tried the solution u provided,but didnt work...it just suppressing all the rows
 
Any other idea...


-------------
Regards,
Ashish


Posted By: themessenger
Date Posted: 15 Aug 2008 at 6:24am
If that response is to me then where are you putting this logic?

It should be in a formula, with the formula field replacing the database field.


-------------
Managing Director
www.allmymenus.com


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 6:47am

Hi,

if it is suppressing all the records means their is no
{cp.pendingSettlementDate} which is greater then or equal to currentdate in your table
 
any way... try this
 
You have to create a formula
 
frm1
 
Place the code below in the formula
if {cp.pendingSettlementDate} >=  currentdate then
{cp.pendingSettlementDate}
 
 and then place the formula in details section.
 
cheers
Rahul
 

 


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:22am
no that was not for you http://www.crystalreportsbook.com/forum/member_profile.asp?PF=5158&FID=5 - themessenger
And when we try with removing totext ..it simply gives an error saying "A String is required here"


-------------
Regards,
Ashish


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:24am
Rahul....
there is data in that column ...i have seen it with removing the formula.
 
the formula u gave me...i tried it already ....didnt work ..jus suppressing all the data
 


-------------
Regards,
Ashish


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 7:24am
Hi
 
Is it working now if not can you post sample data for
 
cp.pendingSettlementDate
 
cheers
Rahul


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 7:25am
Hi
 
Can you post some sample data ,also let me know what else you have in record selection formula......
 
Cheers
Rahul


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:28am

Here's is the sample data

08/18/2008



-------------
Regards,
Ashish


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:30am
CryCry

-------------
Regards,
Ashish


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:38am
Hey
if i put the formula like this,
 
else if (totext({cp.pendingSettlementDate})>=("08/08/2008"))then
totext({cp.pendingSettlementDate})
 
it works fine...


-------------
Regards,
Ashish


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:45am
say 08/18/2008 works fine.....but current date format is like
8/18/2008
 so the 0 is missing ....can i change this is either my column or in current date format

-------------
Regards,
Ashish


Posted By: ashisahb
Date Posted: 15 Aug 2008 at 7:46am
can i trim the initial 0 from my date part????

-------------
Regards,
Ashish


Posted By: ashisahb
Date Posted: 17 Aug 2008 at 11:56pm
Guys ...
Its working now .I used Datevalue function to match the date part and constructed the following formula:
 
if (DateValue ({cp.pendingSettlementDate})>=DateValue (CurrentDateTime))
then totext({cp.pendingSettlementDate})
 


-------------
Regards,
Ashish



Print Page | Close Window