SQL Server Report Builder - 如何使包含多个子报表的参数变灰?

SQL Server Report Builder - How to grey out a parameter with multiple sub-reports?

我有一个包含三个子报告的主报告。 I am trying to grey out one of the parameter option when a certain report is selected.我想这样做的原因是因为其中一个子报告没有使用这个参数。 这是我现在使用的代码。显示查询结果的参数是@device。

    --When user select report 2, the parameter displays the device list from table2.
    IF @selectReport = 2
    BEGIN
       SELECT DISTINCT type
       FROM table2
    END

    --When user select report 3, the parameter displays the device list from table3.
    IF @selectReport = 3
    BEGIN
       SELECT DISTINCT type
       FROM table3
    END

    --When user select report 1. I want to grey out the parameter, but I could not do it. 
    --So I created the table contains NULL value. 
    --So, when the user select the report 1, the parameter will show only null value.

    IF @selectReport = 1
    BEGIN
       SELECT DISTINCT type
       FROM nullValueTable1
    END

我希望它在选择报告 1 时显示为灰色,而不是在下拉列表中显示 NULL。有什么想法吗???

您不能将参数设置为灰色。不幸的是,您不能隐藏参数,因为隐藏的 属性 只需要 TrueFalse。你现在所做的可能是你能做的最好的。但是,您可以尝试查看 cascading parameters,也许您可​​以为下拉菜单提供一个稍微更友好的值,例如 "None"。