robthomas09
asked on
Crystal Reports 11 - Date Range Filter
Hello experts,
I have a crystal report that is built on a Command that has a date field in the form of yyyymmdd. I have desire to filter my data based on a user-entered date range, so to do that, I had to first have a formula that converts that field to a number:
@{Due Date}:
CDate (ToNumber (Left ({Command.apptDate},4 )),ToNumber (Mid ({Command.apptDate},5 ,2 )),ToNumber (Right ({Command.apptDate},2 )))
{?Due Date Param}
I built a parameter as a Date datatype, allowing range values, and assigned that parameter to the
Select Filter:
{@Due Date} = {?Due Date 2}
I now have a need to have the select the date equal to the range, but PLUS 30 days from the Due Date Variable above -- @{Due Date}
So, in theory something like:
Select Filter:
{@Due Date} = {?Due Date 2} + 30
So that if the data set looks like:
20130125
20121225
20121125
20121025
20120925
20120825
20120725
And you entered a range of
2012-11-25 to 2012-12-25
it would return dates in this range, up to 30 days in the future, or 2013-01-25:
20130125
20121225
20121125
I appreciate the time and help!
Thanks
I have a crystal report that is built on a Command that has a date field in the form of yyyymmdd. I have desire to filter my data based on a user-entered date range, so to do that, I had to first have a formula that converts that field to a number:
@{Due Date}:
CDate (ToNumber (Left ({Command.apptDate},4 )),ToNumber (Mid ({Command.apptDate},5 ,2 )),ToNumber (Right ({Command.apptDate},2 )))
{?Due Date Param}
I built a parameter as a Date datatype, allowing range values, and assigned that parameter to the
Select Filter:
{@Due Date} = {?Due Date 2}
I now have a need to have the select the date equal to the range, but PLUS 30 days from the Due Date Variable above -- @{Due Date}
So, in theory something like:
Select Filter:
{@Due Date} = {?Due Date 2} + 30
So that if the data set looks like:
20130125
20121225
20121125
20121025
20120925
20120825
20120725
And you entered a range of
2012-11-25 to 2012-12-25
it would return dates in this range, up to 30 days in the future, or 2013-01-25:
20130125
20121225
20121125
I appreciate the time and help!
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks all!
convert(datetime,<datefiel
This will provide you with a field with date format