次の方法で共有


Changes in SSRS 2005 FindString HTMLViewer Command (URL Access)

In SQL Server 2000 Reporting Services, you could use the rc:Findstring command to find and highlight a string inside an HTML report.

 

In 2005, the Report Viewer control is now used to display HTML reports in Report Manager and via URL Access. As a result, the behavior of FindString has changed.

 

Books Online 2005 has the following example of using FindString (ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/rptsprg9/html/6f3410c4-7944-448f-bae8-bab3e8152d46.htm):

 

https://server/Reportserver?/SampleReports/Product Catalog&rs:Command=Render&rc:StartFind=1&rc:EndFind=5&rc:FindString=Mountain-400

 

If you fix this string up a bit (name your server and point to the right report folder) to make it look like so, you'll find it doesn't work, however:

 

https://localhost/Reportserver?/Adventureworks Sample Reports/Product Catalog&rs:Command=Render&rc:StartFind=1&rc:EndFind=5&rc:FindString=Mountain-400

 

Donovan Smith enlightened me on the following:

 

  • The Report Viewer control essentially ignores FindString
  • If you turn the toolbar OFF (rc:Toolbar=False), then the HTML renderer picks up the FindString DeviceInfo tag
  • Even after you turn off the toolbar, you must ALSO provide the page number on which you want to search using rc:Section=<pageno>

 

So, assuming we want to find the string "Mountain-400", and we know that the value lives on page 4, we'd do this:

 

https://localhost/Reportserver?/Adventureworks Sample Reports/Product Catalog&rs:Command=Render&rc:ToolBar=False&rc:Section=4&rc:FindString=Mountain-400

 

This still begs the question of what to do if you don't know ON WHAT PAGE a particular string will be found...If you don't, you must first use the SOAP ReportExecutionService.FindString Method against your report which will return the page number on which the string can be found...Then, you plug this information into your URL Access String.

Comments

  • Anonymous
    January 12, 2008
    Thanks for this correction.  I just finished a class in SQL Report Server and the syntax followed the MS documentation which didn't work on my SQL 2005 server.  Your syntax works.Why doesn't the cursor go to the found and now highlighted text as if I had done a control-F?  Also, if there is more than one matching string, it only highlights the first instance.  Can either of these issues be corrected?Your blog just became a favorite for me.  Keep up the great work.
  • Anonymous
    November 15, 2008
    I have the same question.  The find string is not scrolling the report to that section. Is there any way to not only refresh the report but also scroll to a specific section in the report using URL access