Several methods are available
for delivering reports to users on demand or by subscription. Most
popular is the Report Manager interface described earlier. You can embed
reports in SharePoint Portal using the included Web parts. Direct
browser access is handled by URL parameters. There is also a ReportViewer control that programmers can embed in ASP.NET or Windows Forms applications.
Delivery on Demand
Reports are available on demand through Report Manager and direct URL browser Web connections.
Report Manager
The
basic navigation concepts for Report Manager were described earlier.
Users navigate the folder namespace hierarchy or use the search prompt
to find the desired report. Folder and report items are presented as
single-click hyperlinks. Clicking a report runs the report with a
control toolbar at the top of the page. The toolbar has buttons for
paging, zooming, search, export, refresh, and printing, as shown in Figure 1.
The search text box
accepts a string. Entering the string enables the Find and Next links,
which help you search larger reports for a particular phrase.
The Print button
loads a print preview ActiveX control that downloads from the report
server. You can set device properties, adjust margins, and select page
ranges.
If the report requires
parameters, a text box or drop-down list is included on the toolbar for
each parameter. Fill in the details or select from the list. Click the
View Report button to render the report and see the Report Viewer
toolbar. Some parameters are dependent on each other, as described
earlier. In this case, selecting from one list fills the next.
The Select A Format
drop-down list works in conjunction with the Export link to render
reports in a variety of presentation formats. The output options are
discussed later in the “Presentation Formats” section.
SharePoint Web Parts
Two
SharePoint Web parts are included that enable folder navigation and
report viewing. These work with SharePoint Services or Portal Server.
The Web parts must be installed on the SharePoint server using the
Stsadm.exe utility. Report Manager must be installed and operational
because the Report Viewer Web part makes URL calls directly to this
site. If SharePoint and Reporting Services live on the same machine, the
Reporting Services virtual directories must be excluded from SharePoint
Services.
You add the Web parts to a
SharePoint page. You can use Report Viewer by itself or in tandem with
Report Explorer. In standalone mode, the report server address and
report path are entered in the Web part’s Properties dialog box. You
cannot enter required parameters. The report runs automatically when the
page is displayed and prompts you for the parameters. If you want a
page with the parameters preset, use a PageViewer Web part and the URL
access approach described next.
The Report Explorer Web
part can display the contents of a folder on the report server. You can
select a report and have it linked to a Report Viewer Web part for
display. Report Explorer also has links for subscription management.
Browser URL Access
Instead of
navigating Report Manager, it might be preferable to display a report
directly in a browser window. This technique allows integration with
existing Web sites and forms applications using a browser control. You
can customize the report viewing and navigation experience by including
parameters in the URL phrase. You can also pass report and query
parameters in this fashion. The URL phrase is often used in a Web page
hyperlink that opens in a new target window or iframe.
Two sets of parameters are used to control navigation and viewing options. The viewer commands are prefixed with rc: and include Toolbar, Parameters, DocMap, Zoom, Find, Paging, and Stylesheets. The report server commands are prefixed with rs: and include Format, Language, and Snapshot. Samples of the URL syntax are shown in the URL Access programming sample.
ReportViewer Control
The ReportViewer control is part of the .NET Framework 2.0. It works in Windows Forms, as shown in Figure 2, and Web pages, as shown in Figure 3.
You can configure ReportViewer
to render a report locally or from a report server. Both use the same
basic rendering technology. The local client-based rendering relies on
an RDLC file included in the project. The report server method requires a
report server URL and a report path. Properties are set to configure
toolbar, navigation, and output options. This control is provided
royalty free and is a great addition to any polished .NET application.
Subscriptions
You can automate report
delivery through subscription services. You can link or attach a report
to an e-mail message or save it to a file share. You create
subscriptions on the Subscription tab of a report;
they are summarized in the My Subscriptions link at the top of each
Report Manager page. Note that all subscriptions require cached
credentials in the report data source.
Once this requirement is
met, the New Subscription button on the Subscription tab opens a page
that prompts for the delivery method. Report Server File Share is one
option. If e-mail settings are configured for the report server, the
second option is Report Server E-Mail.
Subscriptions must have a
schedule. You can manually create a schedule for the report or use a
shared schedule maintained by an administrator in the Site Settings
area. A schedule can specify running once or repeating hourly, daily,
weekly, or monthly. Select the desired days and time. Start and end
dates limit the lifetime.
Subscriptions are
dependent on the SQL Reporting Services Windows service and the SQL
Server Agent service. Both must be running to successfully complete your
subscription.
E-Mail
The e-mail delivery
method creates a single e-mail message with a report link or an attached
file. Links are more efficient for internal reporting and usually
connect the user directly to Report Manager. Attachments are appropriate
for external mailings, typically in PDF or XLS format. You can specify
the To, Cc, Bcc, Subject, Priority, and Body (comment). You are prompted
for any required parameters at the bottom of the form. Formatting
support is limited. Highly stylized messages require a custom delivery
extension. The same is true for multiple file attachments per message.
Shared Folder
The folder delivery
method creates a single file for each report. You enter the path and
select a report format. Credentials are required for access to the file
share. Options for overwrite and file versioning are available.
Data-Driven Subscriptions
Data-driven
subscriptions can generate e-mails or shared folder files. The required
settings are provided by a database query. You can use a
subscription-specific or shared data source to host a query that returns
one row for each report that you want to generate. The columns include
names such as To, Cc, Bcc, Subject, filename, path, render_format, and
values for required report parameters. You map these directly to the
required settings.
This
method provides a lot of flexibility for customized report
distribution. You can create a sales report for hundreds or thousands of
employees or customers that is then tailored to specific regions or
product areas. This is also a good way to maintain archived reports to
satisfy retention policies.