SSRS Report - Dataset Filters

谁说我不能喝 提交于 2021-01-28 12:10:06

问题


I've written a report for SSRS and Im using dataset filters with expressions to filter the report info. I seem to either have this expression wrong or the filter is not working correctly:

=IIf(Parameters!DoctorID.Value = "All" Or Parameters!DoctorID.Value = "", "*", Parameters!DoctorID.Value)

What I want to accomplish with the above code is if DoctorID = ALL or "" (blank) then I want to omit it from the filters so I return information for all doctors. However, whenever the value of DoctorID = ALL, I'm returning no rows what so ever. It should be the case that i'm getting ALL rows since DoctorID is not a specific number.

Does the "*" (star) not denote an omitting of that filter? Am I doing something wrong here?

Thanks!


回答1:


The filter formula you provide is only half the equation: what is the operator and what are you comparing this to? And yes, I haven't seen SSRS use asterisk as a wildcard.

Consider putting your filter into the query for the dataset. The SQL WHERE clause can get pretty powerful. I would write your filter into the query as

  ...
WHERE
   @DoctorID = 'All' OR @DoctorID = ''
   OR @DoctorID = myTable.DoctorID

This will also let you move to a multiple value parameter pretty easily.



来源:https://stackoverflow.com/questions/9202358/ssrs-report-dataset-filters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!