date Range parameter in Crystal

Posted on 2006-06-08
Medium Priority
Last Modified: 2008-03-03
Hi All,   need help quick.

First I have a Date Range Parameter in my crystal report.   I use this parameter to determine if the Hours fall with in the date range.      Now I need to add a column that is Previous month.   Since this field is not actually a DATE field I can not use it in the DATEADD function.   So I stripped the field to a text field to give me the StartDate in a field Called StartDate.   This is a Formula field and Not defined as a DATE field.   So I can not use the StartDate in the DATEADD function to get the previous month.

So basically what I need is the the Previous month Range based on the parameter entered for the Date Range.   The parameter entered is always a single month.

this is urgent please help
Question by:Inframap
LVL 16

Assisted Solution

wykabryan earned 240 total points
ID: 16862015
if it is always just one month the follow should work
your startdate formula:

date(cstr(minimum({?Parameter Daterange})))

Then another formula you are going to find the start of the new month and year
if month({@startdate}) = 1
    then date(year({@startdate})-1,12,1)
    else date(year({@startdate}),month({@startdate}),1)

I would then compare month and year of this formula to your record selection.
LVL 28

Accepted Solution

bdreed35 earned 260 total points
ID: 16862100
You will need to open up your selection criteria to allow that data to be returned:

{table.date} in dateadd("m",-1,minimum({?Date Range})-day(minimum({?Date Range}))+1) to maximum({?Date Range})

This calculates back to the first day of the month prior to the start parameter date through to the end parameter date.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question