I. project requirements
During project creation today, there is a requirement as follows: there is a report in The Report Server, and the report has a parameter doctor_name, which allows multiple values, all by default. However, it is meaningless to select multiple options on the front-end page. Therefore, you need to select one option. However, you need to select multiple options on other pages. Therefore, set doctor_name to allow multiple values. Therefore, the specific requirement is that when a doctor is selected on the front-end page, the report information of the doctor is queried. If no doctor is selected, all doctors are selected by default (equivalent to multiple values ).
Ii. Solutions
Set the dataset query statement.
SELECT ... FROM ... WHERE (yourcolumname IN (@doctor_name))
Set the dataset as a parameter expression
The parameter expression is:
=SPLIT(JOIN(Parameters!doctor_name.Value,","),",")
Now, in the background of the front-end ASPX page, we can upload an array.
string[] doctorlist = new string[this.lbxListDoctor.Items.Count]; for (int i = 0; i < this.lbxListDoctor.Items.Count; i++) { doctorlist[i] = this.lbxListDoctor.Items[i].Value; } var rpdoctor = new Microsoft.Reporting.WebForms.ReportParameter("doctor_name", doctorlist); serverReport.SetParameters(rpdoctor);
Report Server Multiple Value multi-value selection