3 parameters as one combined parameter for filtering.

Hi guys

In SSRS, we create a parameter so that the result can be filtered by it using a dropdown list.

so for example,

Select * from customerService
where custoemrname = @customername and callingTime = @callingTime and duration = @duration

If we do this, 3 parameters are created. For example we can create cascading parameters with these parameters.

However, I am just wondering if I can display all three parameters as one combined parameter for filtering so that there will be only one parameter instead of 3 separated parameters and the parameter will display something like in 'Name / CallingTime / Duration' format as below:
If I click my one and only parameter, it will display
Jane Doe / 10:00 AM / 30 sec
Naomi Sunshine / 10:01 AM / 82 sec
John Doe /  12:00 PM / 15 sec
Jane Doe / 12:03 PM / 30 sec
Naomi Sunshine / 1:02 PM  / 149 sec

Thank you so much!
IzzyTwinklyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
It is not a good idea to combine the criteria like that. it will slow down the process.

Question: Do you ever want to specify 1 out of the three criteria? Or 2 out of three or perhaps all 3. And do you want thoes not specified to be ignored?

Mike
Mike EghtebasDatabase and Application DeveloperCommented:
if so,

Declare @Field1 = '';
Declare @Field2 = 'xx';
Declare @Field3 = 'yy';

Where Field1 = coalesce(@Field1,Field1)
   AND Field2 = coalesce(@Field2,Field2)
   AND Field3 = coalesce(@Field3,Field3)

In this WHERE clause @Field1 with null value will be ignored (in other word, it will return all values for Field1 as if no criteria has been applied to this field).

But, you need to make sure the drop boxes cmbField1, cmbField2, and cmbField3 are truly synchronized.

Your suggested solution aside from poor performance will force you to specify all 3 critarias.

Mike

BTW, why method A below is slower than method B?

A) Where Field1 + Field2 + Field3 = @Field1 + @Field2 + @Field3   '<-- your suggested method

B) Where Field1 = @Field1
        AND Field2 = @Field2
        AND Field3 = @Field3

Because operation (calculation) left of = sign makes indexes useless (see http://en.wikipedia.org/wiki/Sargable).

Method C has also useless index issue thus slower than method D below.
C) Where Field1 Like '%' + Field2 + '%'
D) Where Field1 Like Field2 + '%'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSRS

From novice to tech pro — start learning today.