SSRS Parameters

Sherry H 20 Reputation points
2023-02-19T12:32:01.08+00:00

Hi

I am working on a report that has a parameter for student ID. Currently, all student IDs are getting listed in a drop-down list and users have the option of either selecting one student ID from the dropdown and seeing the report for that specific student or leaving it as null and seeing all students' reports.

Now users have requested to have the option of having a textbox too, so they don't have to browse the dropdown list if they want a single student report, instead just easily type the student ID in a textbox and pull the report.

I have now defined a second parameter for student ID and have defined an expression where the query fields are defined. In the expression, I set if the parameter for textbox is NULL then take the parameter from the dropdown, else take the parameter from textbox. When the textbox (P_StudentID) is null it works, but if I type in any valid student ID in the textbox it doesn't pull any report.

=IIF(ISNOTHING(Parameters!P_StudentID.Value), Parameters!P_STUDENT_ID.Value, Parameters!P_StudentID.Value)

Is anyone able to help?

Thanks

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.
3,010 questions
0 comments No comments
{count} votes

Accepted answer
  1. AniyaTang-MSFT 12,451 Reputation points Microsoft External Staff
    2023-02-21T05:55:16.12+00:00

    Hi @Sherry H

    According to your expression, you have two parameters P_StudentID and P_STUDENT_ID to select the student id. Among them, P_STUDENT_ID is to control the drop-down list, and P_StudentID is to control the text box, right? You tried my method and put your expression in P_STUDENT_ID, but it still doesn't work, right? But my parameters can run, I will show you detailed screenshots, hope to find some problems.3

    4

    5

    6

    Best regards,

    Aniya

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AniyaTang-MSFT 12,451 Reputation points Microsoft External Staff
    2023-02-20T03:38:54.9566667+00:00

    Hi @Sherry H

    I set two parameters, id1 and id2, and tested according to your description, it does not work when id2 manually enters the value, which may be due to id1 controlling the data.

    Then my idea is to modify the expression of id1, when id2 is empty, use the parameter of id1, otherwise use the parameter of id2. That is to use your expression in the parameter P_STUDENT_ID.

    1

    Result:

    2

    3

    Best regards,

    Aniya


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.