Reputation: 494
Is it possible to choose different queries based on a parameter in SSRS? I have 5 different queries and i want to choose one of them. I dont want to merge these queries via using "Union". All of the queries have the same fields. Is this possible?
Upvotes: 1
Views: 1987
Reputation: 419
Try this. I am not completely sure but it should be possible. Go to Report Dataset Properties (View > Report Data > Datasets > ReportDataSource > Right click - Dataset Properties). In the Query > stored procedure name field - you should be able to specify an expression. Click on "Fx" button and write expression. Sample given below.
=IIF(Fields!Param1.Value = "x", "SP1", "SP2")
Upvotes: 1
Reputation: 322
you can use union in the below way:
select ... where 1 = param
union
select ... where 2 = param
union
select ... where 3 = param
union
select ... where 4 = param
passing param values 1 will only pull results from first query and similarly for 2,3 and 4. Hope this works for you.
Upvotes: 0