Search code examples
sql-serverstored-proceduresreporting-servicesssrs-2008-r2ms-reports

SSRS: Passing/Setting parameter to Dataset using Expression


I am using Microsoft SQL Server Report Builder 3.0. I have created a Stored Procedure (stored_procedure1) in the database which has a Parameter (parameter1). Here, stored_procedure1 returns result1.

Then, I used stored_procedure1 to create a Dataset (dataset1) in the Microsoft SQL Report Builder 3.0. Next, I created a Table (table1) in Microsoft SQL Report Builder 3.0 with 2 rows and 2 columns (total 4 cells).

I would like to fill each element of table1 with result1 from dataset1. Hence, I set expression of each cell of table1 as follows:

=Sum(Fields!result1.Value, "dataset1")

When I run this report, it works perfectly and asks me to enter parameter1. However, I want to use single Dataset (dataset1) with different values of parameter1 for each cell of the table. Hence, I want to pass/set parameter1 with unique parameter_value for each expression of table cells. Say I want to set parameter1 = parameter_value1 for first cell.

For example, if I need to set parameter_value = 5, I did something like

=Sum(Fields!result1.Value, "dataset1"), Parameters!parameter1.Value = 5

I also tried following:

=Sum(Fields!result1.Value, "dataset1") & Parameters!parameter1.Value = 5.

It doesn't work.

In summary, I coudln't pass or set parameter value together with an expression. Can we set/parameter value.

I would like to thank you in advance.


Solution

  • If anyone got stuck with this problem, I found a way around for this. T

    here is no way one can pass parameter within expression.

    You will need to create a subreport to do this. You can pass parameter to subreport.

    Its little time consuming. However, it seems there is no other way around.