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

Record Selection based on parameter

Status
Not open for further replies.

chrismcaniff

Programmer
May 18, 2006
8
0
0
US
Hi,

I have a parameter with these choices
Dept 1
Dept 2
Dept 3

If user selects Dept 1, then I want the record selection to only show items in Category 000 to 250. If selects Dept 2, then only show items in Category ranging from 251 to 500. Category is a String field in the database.

Previously I had the Category Ranges as a parameter instead of Depts and this worked fine. But I'd like the user to just select the Dept and have the report translate to the correct Category Range and then display records based on this.

I am not sure how to do this, any help would be really appreciated ?
 
Use a record selection formula of:
Code:
({?Parm} = "Dept1" AND {Category} in "000" to "250")
OR
({?Parm} = "Dept2" AND {Category} in "251" to "500")
OR
({?Parm} = "Dept3" AND {Category} in "500" to "999")

- Ido


view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
For readability you can also use:

if {?Parm} = "Dept1" then
{Category} in "000" to "250"
else if
{?Parm} = "Dept2" then
{Category} in "251" to "500"
else if
{?Parm} = "Dept3" then
{Category} in "501" to "999"

Note that Ido's 3rd clause double includes 500, be careful as it can obviously happen to the best to overlook this.

-k

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top