简体   繁体   中英

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?

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.

我会使用Nathan,但另一种方法是将过滤器设置为正常但将表达式包装在一个使过滤器短路的IIf函数中:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM