SSRS - Report Parameters

what is the best way to do this.

I have a report in SSRS that will have a drop down  that is Active/Inactive/all.

The column in the stored proc to evaluate would be

lactive = 0    (Inactive)
lactive  = 1   (Active)

But the user woudl like to let the user select all so that both would be in the query as well.

LVL 11
Robb HillSenior .Net DeveloperAsked:
Who is Participating?

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

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.

Daniel ReynoldsSoftware Applications Developer / IntegratorCommented:
Can you clarify what it is exactly that you are asking help on?

If you don't want to filter on that column, then you simply alter your query to not filter on the column in question.
Robb HillSenior .Net DeveloperAuthor Commented:
I want to be able to pass three values to the proc from SSRS....only 2 of the values actually are values in the database to match on.

I need a where clause that would be dynamic in that it would handle a parameter than was equal to one of the two values or just return all
Pawan KumarDatabase ExpertCommented:
Hey Robb,

can you send me the stored procedure code and the code you are using to fill this drop down. We need to make some changes in there.

Basically we have to set values like Active - 1 / Inactive - 0 /all - 2(may be) , So when the use selects Active we will pass value 1, When the use selects value inactive we will pass 0 to the stored procedure.

If the user selects all then we will pass 2 and we will NOT apply any filter to the query.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Robb HillSenior .Net DeveloperAuthor Commented:
I didnt create  that yet...let me do that....this was all in my head:)
Robb HillSenior .Net DeveloperAuthor Commented:
Let me try and say it like this...

I have a column c.lActive

I have a Parameter called @lActive

I have a dropdown in my SSRS for @lactive which contacins 3 values.

1 / Active
2/ Inactive
3/ All

If I was to write a sql to just do this...."very simplified version"

To get Active it would be select  * from some table where lactive = 0
To get Inactive it would be where lactive = 1
To get All I guess that would be either no where cluase...or maybe you just do lactive = lacitve..somthing like that?
Robb HillSenior .Net DeveloperAuthor Commented:
This stored proc when im finished will have some 17 this is just the first one...

I have another after this that is similar.

It will be a list as well in SSRS.

the list is
1 Native
2 Linked
3 All

The sql would be select * from some table where t1.[Native/Linked] = 'Native'
Where t1.[Native/Linked] = 'Linked'

Where t1.Native/Linked] = ever I am supposed to get all here..mayhbe its just Native/linked
Robb HillSenior .Net DeveloperAuthor Commented:
Also i can change these 2 dropdowns in SSRS if needed
Robb HillSenior .Net DeveloperAuthor Commented:
I think this is.....does this make sense?

where (((@NativeLinked = 1 or @NativeLinked= 2) and t2.[Native/Linked] = @NativeLinked) or (@NativeLinked = 3 and t2.[Native/Linked] = t2.[Native/Linked]))
Robb HillSenior .Net DeveloperAuthor Commented:
nevermind that doest make sense
Robb HillSenior .Net DeveloperAuthor Commented:
where (((@NativeLinked = 'Native' or @NativeLinked= 'Linked') and t2.[Native/Linked] = @NativeLinked) or (@NativeLinked = 'All' and t2.[Native/Linked] = t2.[Native/Linked]))
Robb HillSenior .Net DeveloperAuthor Commented:
where (((@NativeLinked = 'Native' or @NativeLinked= 'Linked') and t2.[Native/Linked] = @NativeLinked) or (@NativeLinked = 'All' and t2.[Native/Linked] = t2.[Native/Linked]))
(((@ActiveClient = 0 or @ActiveClient= 1) and c.lActive = @ActiveClient) or (@NativeLinked = 3 and t2.@ActiveClient = c.lActive))

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
Robb HillSenior .Net DeveloperAuthor Commented:
only answer and this works
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
Microsoft SQL Server

From novice to tech pro — start learning today.