简体   繁体   中英

SSRS - Getting report selected parameter with JavaScript

I'm using Ifrme to add a SSRS report to my site.

I want to send a link to the current filtered report, so I need to know the report's parameters. My question is how can I know (with JavaScript or either way) which paramters the select? I'm asking for the hidden paramaters also (which can by select by the report creator).

Thanks in advance.

My understanding of an iFrame is that it just references a webpage (or html content). I'm not sure about this, but I suspect that if you wanted to call components (ie, parameters) from an SSRS report, you would have to use the SSRS plug-in. However, I haven't played around with that in quite a while.

Another solution would be to put the link you want on the report itself which would take you to the report browser (away from your site) with all the current parameters carried through. If you wanted to do it this way, you would create a textbox with text like "Click here", add an action to "Go to URL".

The url would be constructed like this:

="javascript:void(window.open(' & Globals!ReportServerUrl & "/Pages/ReportViewer.aspx?" & Globals!ReportFolder & Globals!ReportName & "&Param1=" & Parameters!Param1.Value & "&Param2=" & Parameters!Param2.value & "&Param3=" & Parameters!Param3.value & "'))"

Note, you could also add all sorts of other controls in the link that will hide the parameter bar, force certain rendering formats, etc. More details on that here .

I know this isn't exactly what you're looking for but no one else had replied yet.

Another way would be to get the parameters & their values via jquery:

var parameter_name = $('#MSOPageViewerWebPart_WebPartWPQ1').contents().find("table[name^='ParameterTable_m_sqlRsWebPart'] >  tbody > tr span")[0].innerHTML;

var parameter_value = $('#MSOPageViewerWebPart_WebPartWPQ1').contents().find("table[name^='ParameterTable_m_sqlRsWebPart'] >  tbody > tr select option ")[0].label;

You need to iterate on all the parameters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM