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

Filtering on multiple parameters 1

Status
Not open for further replies.

Dirtless

Programmer
Apr 16, 2010
29
CA
Good morning;

Ultimately I want to add four parameters to a report I am preparing, but for now I'm dealing with just two. I started with {?YearParameter}, a dynamic parameter that repopulates when data is entered for a new year. The filter is simple, simply looking for records where the recording year equals the parameter. The report will always be run just for a single year.

There is a second field (sex) which is numeric: 1 for male, 2 for female and 3 for unknown. I want to be able to filter for any of those options, plus ALL. I have set up a static parameter "Gender" which is string type.

I'm having trouble with the filter. Conceptually it goes like this: filter for records where the year matches the first parameter AND (if Gender = 'Male' the filter must also look for record with sex=1). Once we include 'Female' and 'Unknown' and 'All' it gets more complicated.

Does anybody want to speculate on the easiest approach? Remember that ultimately I want to add additional parameters.

Thanks.

D


 
(If Gender <> 'All' then
(If Gender = 'Male' then sex = 1
else If Gender = 'Female' then sex = 2
else sex = 3)
else true)

Using outer brackets allows you to use and with other parameter conditions too.

Ian
 
I would have set up a number parameter {?Gender} and then added the values (0,1,2,3) with corresponding descriptions (All, Male, Female, Unknown) in the parameter set up screen, and then selected "true" for Prompt with Description Only. Then the formula would just be:

{table.year} = {?Year} and
(
(
{?Gender} <> 0 and
{table.gender} = {?Gender}
) or
{?Gender} = 0
)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top