Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Date Range parameter and then subtracting months backwards?

Status
Not open for further replies.

pokerace

Technical User
May 24, 2005
118
US
Crystal 10 Interbase 7.1

I have created a report that has a date range parameter and I want to add in a formula that will pull information based on the previous month of the enterd date range.

For example, if my a date range is entered as 1/1/2006 to 1/31/2006 I want to create a formula that is able to pull data from another date range of the previous month. Then subsequent reports that go back 2 previous months, three previous months, 6 months, 1 year, and two years as all seperate monthly ranges.

I was wondering if I can do something like the following:
{Contact.Placement Date} = {?MonthlyDateRange}-1

but obviously that doesn't work for my purposes.

Sorry if this sounds confusing. Just let me know if I need to explain in more detail.
 
This is actually an ACT! 2000 database and not Interbase.
 
Not sure I follow, but if you want to be able to choose how many months prior to the selected date range, then create a second parameter {?numberofmonths} of number datatype. Then in your record selection formula you could use something like:

{table.date} in dateadd("m",-{?numberofmonths}, minimum({?daterange}) to maximum({?daterange})

Then use conditional formulas to break out the prior dates, e.g.,

//{@priordates}:
if {table.date} < minimum({?daterange}) then {table.amt}

//{@inrange}:
if {table.date} = {?daterange} then {table.amt}


An alternative approach would be to limit the main report to the daterange in the record selection formula and then add a subreport that is based on prior dates.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top