Rish501
Rish501

Reputation: 21

SSRS Enable/Disable filter based on parameter Value

I have a report parameter of boolean type. If the value is true, a filter needs to be applied to a dataset, and if false it should not filter. Sounds simple, but can't figure out.. Any suggestions?

Upvotes: 0

Views: 5471

Answers (2)

glh
glh

Reputation: 4972

I'd use Nathan's but an alternative would be to set up your filter as normal but wrap the expression in an IIf function that short circuits the filter:

=iif(parameter!myboolean.value = 1, parameter!myfilter.value, fields!field_im_filtering.value)

Upvotes: 0

Nathan Griffiths
Nathan Griffiths

Reputation: 12756

In your dataset query you can add logic like:

WHERE
(
   @MyBooleanParam = 1 AND <filter code>
)
OR
(
  @MyBooleanParam = 0
) 

So if the parameter is True, then the filter logic is applied in the query, if the parameter is false then no filter is applied.

Upvotes: 2

Related Questions