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
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