Site sponsored by: Idera The gold standard of SQL Server performance monitoring & diagnostics.
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share you SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Claytons Data Mining (Part 2)
Backup System Databases Using Maintenance Plans
Overview of Maintenance Plans in SQL Server 2008
Monitoring Index Fragmentation

More     
 
Latest FAQ's

How to alter a User Defined Data Type?
How to unzip a File in SSIS?
How to view previous query plans?
ALTER TABLE SWITCH statement failed because the object '%.*ls' is not ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> reporting services >> Using Report Parameters in SQL Server Reporting ...

Using Report Parameters in SQL Server Reporting Services

By : Dinesh Asanka
Dec 17, 2007

Page 3 / 4

Data Body

We have defined and configured three parameters. Now we need to set a data set for main data body. I have defined dsCustomer data set with following T-SQL.

SELECT        i.CustomerID, c.FirstName, c.MiddleName, c.LastName, c.Phone, c.EmailAddress, a.AddressLine1, a.AddressLine2, a.City, a.PostalCode

FROM            Sales.Individual AS i INNER JOIN

                         Person.Contact AS c ON c.ContactID = i.ContactID INNER JOIN

                         Sales.CustomerAddress AS ca ON ca.CustomerID = i.CustomerID INNER JOIN

                         Person.Address AS a ON a.AddressID = ca.AddressID INNER JOIN

                         Person.AddressType AS at ON ca.AddressTypeID = at.AddressTypeID

WHERE        (a.City IN (@City))

Where the @City parameter contains multiple values of city, you need to use the IN function. Table control was used to present data.

Display Parameters

Normally you need to display the selected report parameters value in the report. For country and province it is straight forward; =Parameters!Country.Label and =Parameters!Province.Label  are values needed to display for the country and province. As city is a multi-value parameter, you cannot use =Parameters!city.Label. Instead, you need to use =Join(Parameters!City.Label,","). From the JOIN command, it will concatenate all the values in the City parameter. You can define the character you want to join the values from the JOIN command.

Passing Parameters

Most of the time, you may not stop after developing just one report. Instead, you will build series of reports. In that case, you may need to pass parameters from one report to another. There are two ways of calling one SSRS report from another. One is subreport and the other is the jump to report option. There is not much of a difference in passing parameters using either method.

For example, if you want to display customers in Berks and Berkshire cities in England, UK, you would need to drag & drop the text box and type in the necessary text value in the text box. Right click the text box and select properties. Select the Navigation tab, then select the Jump to Report option and finally select the report you want to navigate to. In this case, it will be the report named Report. Then select the parameters button to pass the correct parameters.

You should remember that you need to pass the parameter value, not the label. You can see that we have passed GB for country (not United Kingdom), and the same for Province. As city is multi-value parameter, you need to use the Split command with the string of cities.

In case you need to pass parameter values from a parameter, you need to specify the parameter as indicated in following image, which shows an example from the subreport. However, there is nothing different between this and the earlier method.

You can see that the user interface is also the same as the Navigation method. In addition, it doesn’t make a difference whether it is a multiple parameter or not.


<< Prev Page     Next Page>>    








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved