javascriptreporting-servicessqlreportingservice

SSRS passing multi-value parameters to open report in additional window


We've created a report with Report Builder, published to the report server. Report 1, the primary report has 6 parameters; 3 multi-value params and 3 single value params. Would like Report 2 to open from Report 1 but in a separate window and pass all 6 parameters. In Report 2, they are also built as parameters. Parameters: Neighborhood (multi) Start (single) End(single) Source (multi) Data_type(multi) Prov_type(single)

In Report 1 we've created a text box with an action to open a javascript command. Here's the current call in Report 1 that opens another window but gives the generic error "not valid"

javascript:void(window.open('http://ourcompany/Reportserver/Pages/Report.aspx?%2fReports+in+Development%2funknown+provider+detail&rs:Command=Render&NEIGHBORHOOD="+join(Parameters!NEIGHBORHOOD.Value, "&NEIGHBORHOOD=")&"&SOURCE="+join(Parameters!SOURCE.Value,"&SOURCE=")&"&DATA_TYPE="+join(Parameters!DATA_TYPE.Value,"&DATA_TYPE=")&"&START="+Fields!START.Value+"&END="+Fields!END.Value+"&PROV_TYPE="+Fields!PROV_TYPE.Value+"'))

I've replaced "Fields" with "Parameters" and it still doesn't work. If I created it passing static fields it works as seen below;

javascript:void(window.open('http://ourcompany/Reportserver/Pages/Report.aspx?%2fReports+in+Development%2funknown+provider+detail&rs:Command=Render&rc:Parameters=true&NEIGHBORHOOD=Mesa&START=11/01/2016'))

Any thoughts? Thanks!


Solution

  • Part of the problem is that you are passing in the multi-value parameters multiple times. For example, part of your expression would result in:

    ...&SOURCE=A&SOURCE=B&SOURCE=C...
    

    You can only set one value per parameter in the URL.

    So the solution to that would be to comma separate the values and pass them in as a single string. Then, in the subreport, you would need to parse them out again.

    "&SOURCE=" & join(Parameters!SOURCE.Value,",")
    

    You may run into additional issues such as URL length limitations, but this will fix the immediate problem.