Search code examples
c#ssrs-2008reporting-services

Set SSRS report variable from code


I building an SSIS report, and displaying it via a ReportViewer asp control. I already know how to pass parameters via code:

reportViewer1.ServerReport.SetParameters(parameters);

How can I do the same for the report's variables ?


Solution

  • AFAIK this is not possible.

    Note that variables aren't meant for input, they are meant for something else:

    When you have a complex calculation that is used more than once in expressions in a report, you might want to create a variable.

    Of course, you can base that calculation on input parameters.

    If you find the need to set a value for a variable when viewing a report, you probably in fact need a parameter. Perhaps you're experiencing the XY problem?