SSRS - 显示空白值

时间:2016-10-18 15:58:57

标签: reporting-services

参数值

enter image description here

我正在尝试显示具有任何状态的所有记录。当用户选择' AllLogs'来自报告中的dropdwon。

  1. 但是当我运行报告时,它会将记录排除在空白之外 状态。
  2. 如何以任何状态(空白,空白,已批准等)拉取记录?

    标签:状态
    价值:%

  3. 我还在参数属性中启用了NULL和Blank值。

  4. 这是我的where子句。

    select u.*,
           (case when i.username is not null then 'individual'
                 when c.username is not null then 'corporation'
            end) as usertype,
           i.education, i.work_since,
           c.headquarters, c.office, c.num_employees
    from users u left join
         individual i
         on i.username = u.username left join
         corporation c
         on c.username = u.username;
    

1 个答案:

答案 0 :(得分:0)

包含所有记录的最可靠方法是不在您的where中进行过滤,这可以通过短路case声明来实现:

where case when @status = '%'  -- This can be any value, such as 'All'
           then 1
           else case when l.Status = @status
                     then 1
                     else 0
                     end
           end = 1

虽然这有点冗长,但如果选择了All选项,则可以实际运行比较,这样可以提高查询效果。

相关问题