Tuesday, December 23, 2008

SSRS Parameters Parameters Parameters

Parameters are nifty little dew dads in SSRS. Here are a list of things I find useful with parameters:


Using a parameter in a where clause in a SQL statement to make the report dynamically select records based on parameter selection.

ex: WHERE (Table.Field = @acme)

Adding a parameter in the connection string to dynamically change servers or databases based on a parameter selection.

ex: = "data source=" & Parameters!server.Value & ";initial catalog=" & Parameters!database.Value

Using a parameter to execute a given stored procedure in the query field

ex: EXEC (@StoredProc)

A hidden parameter is nice way to pass data between two different data sets in the same report

If using a parameter for date selection change the parameter type from string to datetime and the final report will provide a nice calendar button to select the date/time

Parameters provide a great way to link two reports and provide relevant data between the two. Tip: it helps if parameters between two different reports are identical in terms of name, data type, and case sensitive likeness as well.

Using a parameter to selectively hide portions of the report based on parameter choice. Here is an example from the visibility field of a table.

ex: =IIF(Parameters!reporttype.Value LIKE "*CLERICAL*", False, True)

The tittle of your report can be dynamic as well based on parameter selection.

ex: =Parameters!protocol.Value + " " + (iif(Parameters!reporttype.Value = "ABP ECG","Both ECG and ABP",Parameters!reporttype.Value)) + " Procedures Country/Site"

There are countless ways to take advantage of parameters in SSRS. I would be very interested to hear of your ideas and ways you incorporate parameters in your reports! I will add more as I remember them.

No comments:

Post a Comment