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

Report selection using parameters

Status
Not open for further replies.

src2

Technical User
Mar 1, 2001
72
US
I'm trying to create a report in CR 8.5 with multiple report selection criteria using parameters. The first parameter I'm using is a string where the user selects from a list of date ranges. The options they can choose are: today, last 7 days, this month, last month, etc. The next parameter is also a string containing the string they want to search for.

This is the code I've used and it is working but I'm wondering if there is a better way to do it. As you can see some of the code is duplicated which probably isn't very efficient.

Select {?DateRange}
Case "Today":
{CR_View_for_Steve.OpenedOn} in CurrentDate
and Uppercase({?SearchString}) in Uppercase({CR_View_for_Steve.ShortDescription})
Case "Last 7 Days":
{CR_View_for_Steve.OpenedOn} in Last7Days
and Uppercase({?SearchString}) in Uppercase({CR_View_for_Steve.ShortDescription})
.
.
.
default:
{CR_View_for_Steve.OpenedOn} in YearToDate
and Uppercase({?SearchString}) in Uppercase({CR_View_for_Steve.ShortDescription})

One thing that I thought of was creating a variable first and setting the variable according to the case statement but it doesn't work. See example below:

StringVar Range;
Select {?DateRange}
Case "Today":
Range := "CurrentDate"
Case "Last 7 Days":
Range := "Last7Days"
.
.
.
default:
Range := "YearToDate";
{CR_View_for_Steve.OpenedOn} in Range
and Uppercase({?SearchString}) in Uppercase({CR_View_for_Steve.ShortDescription}

I'm also wondering that if I add additional criteria/parameters how that would be incorporated into my code.

Any help would be appreciated.
Thanks
 
Well I figured out my own problem. Basically it was as simple as adding a ; to the end of my select statement. Here's the revised code:

Select {?DateRange}
Case "Today":
{CR_View_for_Steve.OpenedOn} in CurrentDate
Case "Last 7 Days":
{CR_View_for_Steve.OpenedOn} in Last7Days
.
.
.
default: {CR_View_for_Steve.OpenedOn} in LastFullMonth;
and Uppercase({?SearchString}) in Uppercase({CR_View_for_Steve.ShortDescription})
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top