Section 8.1. URL-based


8.1. URL-based

The URL request contains information identifying the report server to use, as well as parameters that are processed by the report server and that control the formatting and rendering of the report. The parameters, parameter prefixes, and combination of supplied parameters in the URL determine how the report server handles a specific request.

For example, open the URL http://localhost/ReportServer?/AdventureWorks Sample Reports/Sales Order Detail&rs:Command=Render. The following figure shows the report that is rendered in the browser.

Figure 8-1. URL-based Access


The information in the URL specifies that you want to do the following:

  • Use the local report server.

  • Access a report in the report server virtual root named ReportServer.

  • Access the report named AdventureWorks Sample Reports/Sales Order Detail.

  • Render the report in the default rendering format for the browser.

Report server parameters are used to control report processing. They are prefixed with rs: in the URL. For example, the URL http://localhost/ReportServer?/AdventureWorks Sample Reports/Sales Order Detail&rs:Command=Render&rs:Format=IMAGE renders the report as a TIFF image.

HTML device-information settings control how the report is rendered in HTML format. They are prefixed with rc: in the URL. For example, the URL http://localhost/reportserver?/AdventureWorks Sample Reports/Company Sales&rs:Command=Render&rc:Toolbar=false&rc:Zoom=200 renders the report at twice the default size without a toolbar.

Report parameters are passed in the URL as name-value pairs separated by an equals sign (=). Pass a null parameter using the syntax parameterName:isNull=true.

Note that report parameters are not prefixed. For example, the report Employee Sales Summary takes three parameters: ReportMonth (integer), ReportYear (integer), and EmpID (string). When you run the report normally, the RDL populates the employee drop-down list using the DataSet named SalesEmps. This corresponds to the following query:

     SELECT E.EmployeeID, C.FirstName + N' ' + C.LastName AS Employee     FROM HumanResources.Employee E     INNER JOIN Sales.SalesPerson SP ON E.EmployeeID = SP.SalesPersonID     INNER JOIN Person.Contact C ON E.ContactID = C.ContactID     ORDER BY C.LastName, C.FirstName 

We need to run this query to determine the employee ID for each employee. Jillian Carson has employee ID 277. The URL http://localhost/reportserver?/AdventureWorks Sample Reports/Employee Sales Summary&rs:Command=Render&EmpID=277&ReportMonth=7&ReportYear=2002 sets the report parameters to return the sales summary report for Jillian Carson for July 2002.

The preceding examples show how to request a report using a URL. This is equivalent to an HTTP GET method. You can also request a report using an HTTP POST method, which transfers the parameter name/value pairs in the HTTP header instead of the URL. Using an HTTP POST method overcomes the maximum allowable URL length limit in cases where a parameter list is long, and is also more secure because the user cannot directly modify the parameter names and values. The following HTML returns the same sales summary report for Jillian Carson for July 2002 as in the preceding example but uses an HTTP POST method:

 <form    action="http://localhost/reportserver?/AdventureWorks Sample Reports/   Employee Sales Summary" method="post" target="_self">     <input type="hidden" name="rs:Command" value="Render"/>     <input type="hidden" name="EmpID" value="277"/>     <input type="hidden" name="ReportMonth" value="7"/>     <input type="hidden" name="ReportYear" value="2002"/>     <input type="submit" value="Render"/> </form> 



SQL Server 2005 Reporting Essentials
SQL Server 2005 Reporting Essentials
ISBN: 735617880
EAN: N/A
Year: 2007
Pages: 31

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net