Report Viewer/Default Parameters

Is it possible for one report to have different default parameters, based on the user viewing the report, when the report is accessed via the Report Viewer?

Thanks.

[12790 byte] By [FAp] at [2007-12-21]
# 1

Assuming you are asking for viewing report through report server: default values can be (1) constant, (2) expression-based, or (3) dataset based.

Regarding (2): you could determine the default value based on the current userid, e.g =iif(User!UserId="abc", "Default1", "Default2")

Regarding (3): you could use the current user information in the query commandtext or as parameter into a stored procedure to dynamically determine the default value.

-- Robert

RobertBrucknerMSFT at 2007-9-10 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...
# 2

If you are using the ReportViewer control in ASP.NET, you can set the value of the parameter programatically based on the current user identity:

this.ReportViewer1.ServerReport.ReportPath = "/SampleReports/Employee Sales Summary";

ReportParameter p = new ReportParameter("EmpID", "20");

this.ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { p });

YicongShen at 2007-9-10 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...

SQL Server

Site Classified