0
votes

Trying to create a SSRS snapshot from C# code. It works fine except when the parameter in the report is a multivalue parameter. How should the multi value field be set up?

parameters[0] = new ReportParameter();
parameters[0].Name = "countryCodeList";
parameters[0].DefaultValues = new string[] { "DK", "FI", "GB", "NO", "SE" };  // ???

parameters[1] = new ReportParameter();
parameters[1].Name = "fromDebitDate";
parameters[1].DefaultValues = new string[] { FormatDateTimeParamter(fromDebitDate) };

parameters[0].MultiValue = true;   // ???

ReportingService.SetReportParameters(report.Path, parameters);

return ReportingService.CreateReportHistorySnapshot(report.Path, out warnings);
1
you should show some more code, but I think that you need to set the Parameter in the report to accept multiple values (SSRS side)Malachi

1 Answers

0
votes

If I remember correctly SSRS is kind of dumb with how it wants you to add multi value as you can't just define and instantiate the values. You need to define them seperately then add them if memory serves, plus then add parameters to the already existing array of parameter objects. I think it is like this, from this site: http://forums.asp.net/t/1338302.aspx

List<ReportParameter> paramList = new List<ReportParameter>();
ReportParameter param = new ReportParameter("ParamName");

// Create the string array of values to pass

string[] values = new string[]{"x", "y", "z"};

// Add a range of elements from an array to the end of the StringCollection.

param.Values.AddRange(GetStringArray());

// Add the parameter to the list of ReportParameters

paramList.Add(param);

// Set the reports parameters

this.ReportViewer1.ServerReport.SetParameters(paramList);