0
votes

I have two reports , in same forder in reportserver. i wanted to link both the reports back and forth passing parameters.

I tried to use jump to Report passing parameter, it works but opens the report in the same window. I am looking for opening the report in a new window , so tried to use the Jump to URL using this expression.

="javascript:void(window.open('http://servername/reportserver?%2fStaffing%2fTest%2fStaffing Forecast Summary&rs:Command=Render&PI_REGION_LIST="+Parameters!PI_REGION_LIST.Value+"&PI_CENTER_CODE="+Parameters!PI_CENTER_CODE.Value+"&PI_PROBABILITY="+Parameters!PI_PROBABILITY.Value+"&PI_X="+Parameters!PI_X.Value+"'))"

could any one help me here. How will i do this dynamically, so that i dont have to change the servername while production move? first 3 parameters are multivalued parameters , is it fine giving in this way? my reports are accessed from report manager itself. what should i give for reportserver ?

i am confused with the ?, &,and / in this whole epxression . what is that %2f. i did some googling on this but nothing is giving me a proper idea.

Your help would be appreciated.

Thanks, San

4

4 Answers

1
votes

I just used 'Jump to URL' and dumped the javascript thing. I used the Expression builder to build the following output based on my server and the report I was calling which needed the parameters prmCUID and prmEnabled:

="http://sk24-cbnks002/reportserver?/Autosweep/Operations/Sweeps+By+Credit+Union&prmCUID=" + Fields!CU_ID.Value.ToString + "&prmEnabled=true&rs%3aParameterLanguage=en-CA"

I hope this helps. I had a tough time getting it to go at first.

-Dave

1
votes

To use Jump to URL (without javascript) you would specify the following:

=Globals!ReportServerUrl & "/Pages/ReportViewer.aspx?"
& "/Staffing/Test/Staffing Forecast Summary"
& "&rs:Command=Render"
& "&PI_REGION_LIST=" & JOIN(Parameters!PI_REGION_LIST.Value, ",")
& "&PI_CENTER_CODE=" & JOIN(Parameters!PI_CENTER_CODE.Value, ",")
& "&PI_PROBABILITY=" & JOIN(Parameters!PI_PROBABILITY.Value, ",")
& "&PI_X=" & Parameters!PI_X.Value

I've placed things on multiple lines and spaced it out to make this easier to read.

The first line specifies the Report Server URL that the original report was run on, so there's no need to hard code the production server URL.

The second line specifies the directory and report to run on the Report Server

The third line tells the Report Server what to do with the report: you could export to CSV with the following

& "&rs:Format=csv&rc:NoHeader=True&rc:Encoding=Ascii&rs:Command=Render"

The last lines specify the parameters to use. (As the first three parameters are multi-valued we join them all together, but separate them with a comma).

In changing to use the javascript functionality (from VBScript for the expression editor in the report designer) we change & for + to perform concanenation. And to explain the "?", "&", "/", "=", and " " these become %3f, %26, %2f, %3d and %20 respectively due to URL Encoding (which you can find out more here).

Unfortunately my Javascript isn't good enough to be certain of the change from VBScript to Javascript but my guess is it would go from something like this:

Globals!ReportServerUrl & "/Pages/ReportViewer.aspx?/Staffing/Test/Staffing Forecast Summary&rs:Command=Render&PI_REGION_LIST=" & JOIN(Parameters!PI_REGION_LIST.Value,",") & "&PI_CENTER_CODE=" & JOIN(Parameters!PI_CENTER_CODE.Value,",") & "&PI_PROBABILITY=" & JOIN(Parameters!PI_PROBABILITY.Value,",") & "&PI_X=" & Parameters!PI_X.Value

to this:

="javascript:void(window.open('" & Globals!ReportServerUrl & "%2fPages%2fReportViewer.aspx%3f%2fStaffing%2fTest%2fStaffing%20Forecast%20Summary%26rs:Command%3dRender%26PI_REGION_LIST%3d" & JOIN(Parameters!PI_REGION_LIST.Value,",") & "%26PI_CENTER_CODE%3d" & JOIN(Parameters!PI_CENTER_CODE.Value,",") & "%26PI_PROBABILITY%3d" & JOIN(Parameters!PI_PROBABILITY.Value,",") & "%26PI_X%3d"+Parameters!PI_X.Value & "'))"

I can't be sure of the validity of this end result in Javascript but it seems OK in the expression editor.

0
votes

SSRS MS SQL Server 2008 R2

inside a TEXTBOX go to the text box properties (F4 or right click->properties) go to action set go to URL set up the following code within the expression (the little Fx at the right):

="http://MYSERVER/ReportServer?/MY REPORT FOLDER/MY REPORT NAME&rc:Parameters=True&rs:Command=Render&TODAY="& CStr(Fields!DT_0.Value)& "&ENG=" &Str(Fields!Employee_id.Value) & "&DT_TO=" & CStr(Fields!DT_6.Value)

The code above is working on my environment here.

Please notice the 3 parameters:

parameter 1 is called TODAY parameter 2 is called ENG parameter 3 is called DT_TO

I was also struggling to pass the parameters.

Their values come from different datasets.

hope this helps ans save someone much time. Because for me it was difficult to make it work

Marcelo Miorelli

0
votes

This amendment to the answer above worked for me - note the separator value in the multi-value parameters. I am using RS2008 and found that all the parameters need to be on the same line in the expression builder

=Globals!ReportServerUrl & "/Pages/ReportViewer.aspx?"

& "/Staffing/Test/Staffing Forecast Summary"

& "&rs:Command=Render"

& "&PI_REGION_LIST=" & JOIN(Parameters!PI_REGION_LIST.Value, "&PI_REGION_LIST=")

& "&PI_CENTER_CODE=" & JOIN(Parameters!PI_CENTER_CODE.Value, "&PI_CENTER_CODE=")

& "&PI_PROBABILITY=" & JOIN(Parameters!PI_PROBABILITY.Value, "&PI_PROBABILITY=")
& "&PI_X=" & Parameters!PI_X.Value