【问题标题】:How to create drop-down list in SSRS based on WHERE clause below?如何根据下面的 WHERE 子句在 SSRS 中创建下拉列表?
【发布时间】:2017-06-29 02:53:36
【问题描述】:

在我的组织中,我们使用与 SQL 数据库通信的 UI 第三方工具。我可以访问数据库,但不能访问该工具。

基于用户可以从下拉列表DairyStatus"Open""Closed""Both"中选择的存储过程

ALTER Procedure
AS
@ShowOpen bit = 0,
@ShowClosed bit = 0
 SELECT
 FROM 
 WHERE 
              AND
                        (
                        (CASE WHEN (@ShowOpen = 1) THEN
                              CASE WHEN (tblNoteRecipients.CompletedDate IS NULL and tblNoteRecipients.IsDiary = 1) or tblNoteRecipients.UserGUID is null THEN 1 ELSE 0 END

                        ELSE
                              1
                        END = 1)
                  AND
                        (CASE WHEN (@ShowClosed = 1) THEN
                              CASE WHEN (tblNoteRecipients.CompletedDate IS NULL) THEN 0 ELSE 1 END
                        ELSE
                              1
                        END = 1)
                  OR    ((@ShowOpen = 1) AND (@ShowClosed = 1))
                        )

所以我的问题是如何在 SSRS 中制作相同的下拉列表? 为了填充这个下拉列表,数据集是什么?

【问题讨论】:

    标签: sql-server reporting-services parameters dataset


    【解决方案1】:

    在 ssrs 中创建一个具有 3 个静态值的参数(同时打开关闭) 在 where 子句中应该是这样的:

    ( @DairyStatus = 'open' and ((tblNoteRecipients.CompletedDate IS NULL and tblNoteRecipients.IsDiary = 1) or tblNoteRecipients.UserGUID is null)) or
    ( @DairyStatus = 'closed' and tblNoteRecipients.CompletedDate IS not NULL) or
      @DairyStatus = 'both'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-17
      相关资源
      最近更新 更多