Six months Date question in Crystal Report

metalteck used Ask the Experts™
I have a crystal report and need it to run for the first 6 months of the year.
For example, if I run the report on 2/1/10, I only want the data from 2/1/09 - 7/31/09.
I need this to be automated, so I can run it twice a year without any parameter prompts.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

report menu > selection formula > record
and place this formula
{Orders.Ship Date} in dateadd("YYYY",-1,currentdate) to dateadd("m",6,dateadd("YYYY",-1,currentdate))

if you want from today to next 6 months use this..

{Orders.Ship Date} in currentdate to dateadd("m",6,currentdate)

and also change the currentdate to reportrundate or whatever

the first comment is for this

 "if I run the report on 2/1/10, I only want the data from 2/1/09 - 7/31/09"

you reduced 1 year from report run date accomplish this use first comment
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

one more way..
if you want run any day of the month and to get data from start day of month to 6 months

1. {yourdate} in cdate(year(currentdate) ,month (currentdate), 01 )  to cdate(year(currentdate) ,month (currentdate)+6, 01 )

@stratdate = {yourdate} in cdate(year(currentdate) ,month (currentdate), 01 )

@enddate =  cdate(year(currentdate) ,month (currentdate)+5, 31 )

=== hope this gives better idea


I will need this report to run twice, once in Feb, then again in August. How can I do that?

well it works if you run the report in feb or august.....

to accomplish this

1. To run manually in feb or aug ................i know you don't want this

2 .you can schedule this report in crystal enterprise to run on these specific dates...what r u using ??  enterprise or any third party scheduler ??----this is automatic
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

To automate the running of a report you need a report scheduling tool.
There are several scheduling tools listed here.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial