How to make dynamic parameter optional and hide if not selected

Rambo_1 1 Reputation point
2021-10-01T13:45:27.767+00:00

Good Day,

I am building a dynamic matrix reports in report builder (SSRS). For my first column I am using a dynamic parameter and specifying the values as column 1,2,3 and allows me to select a column to display by using this expression - =Fields(Parameters!ReportRows.Value).Value. For my second columns I am following the same process but specifying different columns A,B,C,D for the parameter using expression - =Fields(Parameters!ReportRows2.Value).Value. This allows me to select a column 1 from the first parameter and a column A from the second parameter.

PRM 1 PRM 2
column 1 column A Value
Product A Supplier 1 100

I want to make second parameter/column (column A) optional and if I don't select it then I want to hide it from the report.

Thanks for your assistance.

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,935 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 54,731 Reputation points
    2021-10-01T15:42:15.53+00:00

    Depending upon how flexible the parameter is you can either set a default value for it or set it as allowing null or blank. In most cases setting it to allow NULL lines up with your SQL query that you need. The downside is the UI requires the user to select a checkbox to specify it as NULL, at least for a web-based UI. Alternatively you could allow it to be blank. In this case it would need to be a string but shouldn't show a checkbox.

    On the report generation side you can look at the values of the parameters and conditionally show/hide reporting stuff based upon whether it was provided or not.

    0 comments No comments

  2. Joyzhao-MSFT 15,591 Reputation points
    2021-10-04T07:45:56.823+00:00

    Hi @Rambo_1 ,
    Is your requirement similar to: When you select "True" in the drop-down of Parameter 1, the Parameter 2 is hidden; when you select "False" in the drop-down of Parameter 1, the Parameter 2 is visible.
    Unfortunately, you cannot change a parameter's visibility during run time. Alternatively, you can control the second parameter's values based on the selected value of the first parameter.
    In my case, Although I set "Allow Null Value" and "Allow Blank Value" for parameter 2[FilterValue],I cannot dynamically hide/show my parameter 2[FilterValue] based on the selection of parameter 1[RowGroupField].
    137299-05.jpg
    If I misunderstand what you mean,please feel free to correct me.
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.