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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Optional date range parameter

Status
Not open for further replies.

gmc1968

Technical User
Dec 1, 2006
3
US
I have a report that needs to be filtered by two different date fields: Date Returned and Transaction Date. I need a parameter that will allow the user to enter a date range for one of them and leave the other one blank. The english logic would be "Date Returned between start date and end date (parameter #1) or Transaction Date between start date and end date (parameter #2)". I'm using Crystal XI and loading the report into BOE XI R2. Right now, I have to enter a date range in both parameters and play around with the "Include this value" option on each one, but I'm not getting the desired results. Is there a way to create an optional parameter? Also, is there a way to have a blank date range parameter at all?
 
I would create two string parameters, BegDate and EndDate
Then in the record selection
Code:
(If BegDate <> 'ALL' then
fieldName >= date(BegDate)
else True) and
(If EndDate <> 'ALL' then
fieldName <= date(EndDate)
else True)

I am using 'ALL' as a default value.

 
Thanks for the advice. I actually set up a parameter to prompt the user for a filter type selection of 1 or 2. Then I added a formula in select expert to filter the data based on the filter selection.

if {?Filter Selection} = "1" then
fieldname1 = {?Prompt} else
fieldname2 = {?Prompt}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top