2015-04-30 55 views
0

我有一個主要的報告,有三個子報告。我正在嘗試在選擇某個報告時使某個參數選項變灰。我想這樣做的原因是因爲其中一個子報告不使用此參數。 下面是我現在使用的代碼。顯示查詢結果的參數是@device。SQL Server報表生成器 - 如何使多個子報表灰顯一個參數?

--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時變灰。任何想法???

回答

1

您不能灰顯參數。不幸的是,你不能隱藏參數,因爲隱藏的屬性只需要TrueFalse。你現在在做什麼可能是你能做的最好的。但是,您可以嘗試查看cascading parameters,也許您可​​以在下拉菜單中提供一個稍微更用戶友好的值,例如「無」。

相關問題