views:

730

answers:

5

I'm working on a web application that renders a reporting services report as a PDF and one of my requirements is to allow for multiple locations to be included on the same report. To handle this, I have created a multi-value report parameter which seems to do the trick when using the RS UI, etc. But, I am using the webservice for reporting services and cannot for the life of me figure out how to set the value of the parameter to be identified as having multiple values.

I've tried simply setting it as "LOC1,LOC2", but that is being picked up as a single value. I have also tried "LOC1" + System.Environment.NewLine + "Loc2".

+1  A: 

You can send it through as a comma-delimited string if you're willing to parse it on the other end. A lot of languages have a String.Split(",") style method you can use for that.

Either that, or you can construct an array (or list, or collection) and pass that through as the parameter, though this would involve changing the contract on the webservice method.

notnot
A: 

NotNot... I thought about that, but the backend source for my report is an AS400 implementation and I cannot specifiy the paremter like normal SQL i.e. WHERE LOCATION IN(@Locations)...

This leaves me with filtering the data out of the report. Since my parameter is a multi-valued string, I'm not sure how I can set the multi values through the .NET web service call which uses:

ParameterValue[]

for the report.render call.

RSolberg
+1  A: 

I took notnot's idea and created a new parameter on the report that is hidden and multi-value. The value of this parameter is set by splitting the comma seperated string parameter.

RSolberg
A: 

I'm also having this same problem. Microsoft does not document a way to pass multi-value parameters to Reporting Services using the SOAP API.

+1  A: 

Figured it out, you have to each value separately under the same name, snippet:

     //Register parameters
 ArrayList<ParameterValue> parmValues;

 for(Map.Entry<String,String> entry:reportParams.entrySet()) { 
  //is it multi-value?
  if(entry.getValue().contains(",")) {
   //yes, add multiple ParameterValues under the same name 
   // with each different value
   for(String mval:entry.getValue().split(",")) {
    ParameterValue pv = new ParameterValue();
    pv.setName(entry.getKey());
    pv.setValue(mval.trim());
    parmValues.add(pv);
   }
  } else {
   //no, just a single value
   ParameterValue pv = new ParameterValue();
   pv.setName(entry.getKey());
   pv.setValue(entry.getValue());
   parmValues.add(pv);
  }
 }