RDC Report Viewers


RDC Report Viewers

As discussed in Chapter 21, one of the main benefits of using more robust web reporting methods (such as the RDC, CE Embedded, and ASP.NET) instead of just exporting reports to HTML from the Crystal Reports designer is that these more robust methods offer full report interaction, such as drill-down and group -tree manipulation. The trick, though, is how to fully implement this interaction in a web browser. One of the continual challenges faced when web-izing Crystal Reports is supporting all the formatting and interaction options that Crystal Reports provides.

The options with the most cross-platform support are, as you might expect, HTML-based. While more flexibility and interactivity is added with each new revision of HTML (DHTML 4 has some, but very few, formatting limitations from a Crystal Reports perspective), it still has inherent limitations that make reproducing every element of a Crystal Report difficult. And, dealing with interactive options, such as drill-down and group-tree navigation, introduce even more challenges.

While CE Embedded, .NET, and the full versions of Crystal Enterprise have largely adopted pure HTML-based solutions, several thin-client report viewer applications (as opposed to the zero-client HTML viewers) are still used with RDC-based web applications. The Report Viewer for ActiveX is a Microsoft-compatible ActiveX control that can be viewed in Internet Explorer 3.02 or greater. The Report Viewer for Java with Browser JVM and the Report Viewer for Java with the Java Plug-In are Java-based viewers that can be viewed in 32-bit versions of Netscape Navigator 2.0 or greater, Internet Explorer 3.02 or greater, or other Java-compatible browsers. The Browser JVM version uses your particular browser s Java Virtual Machine, whereas the Java Plug-In version uses the Sun Java 2 Runtime Environment. The Report Viewer for Netscape Plug-In views a report inside Netscape Navigator.

These viewers implement almost all the features and functionality of the regular Crystal Reports Preview tab, although there are some visual differences. Both enable you to drill down on group headers and footers, charts , and maps, and both offer full interaction with the group tree. The thin-client viewers maintain most font and object formatting, and they allow you to print reports in their native paginated format on an attached printer.

There are still situations, however, for which an ActiveX control, Java applet, or the Netscape plug-in cannot be used. Perhaps there are security restrictions in your company, performance concerns about network traffic, or non-compatible browsers being used. For these situations, there are two HTML-based alternatives supported by the RDC:

  • Report Viewer for Standard HTML with Frames Requires a browser that can support JavaScript and DHTML 4.0. Frames allow more than one scrollable window to be displayed within the browser at one time; this feature is used to mimic the group tree as closely as possible in a separate frame on the left side of the browser.

  • Report Viewer for Standard HTML If your browser doesn t support frames, you can use this alternative, which displays the entire report without a group tree in a single browser window.

Report Viewers Compared

Each of the various RDC report viewers has advantages and disadvantages, in terms of several factors. The ActiveX, Java, and Netscape plug-in viewers offer more features but also place a higher burden on the web server and network because of their size ; they also have higher browser requirements. The HTML viewers have fewer browser requirements, but they may make some formatting compromises and offer less functionality than the ActiveX or Java viewers. Table 22-1 compares the different viewers and their advantages and disadvantages.

Table 22-1: RDC Report Viewers Compared

Report Viewer

Advantages

Disadvantages

ActiveX Netscape Plug-in

Provides highest mirror-image level of original report and most flexibility, including full group-tree and drill-down interactivity, and accurate printing of reports on your local printer.

Only works with 32-bit versions of Microsoft IE 3.02 or greater, or with newer 32-bit versions of Netscape Navigator. Requires extra time and increases network strain when downloaded to browser.

Java with Browser JVM Java Plug-In

Provides good mirror-image level and high flexibility, such as group-tree and drill-down interactivity, and ability to print reports on your local printer. Works with any Java-compatible browser.

Requires extra time and increases network strain when downloaded to browser. Won't work with earlier browsers that don't support Java. Windows XP support may require download of separate JVM plug-in.

HTML Frames

Will work with browsers that just support frames and JavaScript (such as earlier 16-bit browsers) ”ActiveX and full Java capabilities aren't required. Mimics group tree with a browser frame. Faster initial response, and no control or applet download is required.

Makes some formatting compromises because of HTML limitations. Only prints what's in the current browser window ”original report pagination and layout are not preserved. Drill-down on charts and maps isn't supported. No Export button on toolbar.

HTML Pages

Works with even the simplest browsers that don't support frames, while still allowing pseudo drill-down by creating links in group headers. Faster initial response, and no control or applet download is required.

Makes some formatting compromises because of HTML limitations. Only prints what's in the current browser window ”original report pagination and layout are not preserved. Drill-down on charts and maps isn't supported. No Export button on toolbar.

As a general rule, you should use the report viewer that provides the highest level of user functionality for your particular browser and network environment. If your users are all on a 100-megabit intranet with fast PCs and the latest version of Microsoft IE, there can t be too many arguments made against using the Report Viewer for ActiveX. If you have a mix of Netscape and Microsoft browsers, the Report Viewer for Java will work with both. But, if you are providing reports on your extranet that can potentially be accessed by any number of unknown browsers using 28.8 Kbps modems, you may want to use either of the Report Viewers for HTML to streamline performance and support the widest variety of browsers.

One thing should always be kept in mind: When you design reports to be distributed over the Web, take your target audience s report viewer choices into serious consideration when you design your reports. If your ultimate goal is that reports look good on a printed page, you need to make serious changes to report formatting and layout if your audience will be using HTML-based viewers instead of the ActiveX or Java viewers. If your reports rely heavily on group-tree and drill-down interactivity (detail sections are hidden, lots of charts are included, and so on), don t realistically expect satisfactory results with the HTML- based viewers. And, don t forget that Crystal Reports includes many formatting options, such as drop shadows, underlain sections, and object and section background shading, that may not convert properly to HTML when displayed in the HTML viewers. Always test your reports and make sure you re getting the results you expect in your target report viewer.

Choosing and Customizing RDC Report Viewers

You ll need to determine which of the report viewers you want to provide to your viewer s web browser. You can include commonly available VBScript code to query the browser for its type. If you encounter Internet Explorer, you can automatically provide the ActiveX viewer. If you encounter Netscape, you can provide the Netscape Plug-In or a Java viewer. Or, you can create a control on a web page (perhaps a combo box) that allows the viewer to make the choice.

This book s companion web site provides some intermediate ASPs that you may include in your ASP code to choose the desired report viewer. You ll find SmartViewerActiveX.ASP, ActiveXPluginViewer.ASP, SmartViewerJava.ASP, JavaPluginViewer.ASP, and HTMStart.ASP that instantiate the various viewers. There are also some companion .ASPs that some of these ASPs call (such as FramePage.ASP, Toolbar.ASP, and Cleanup.ASP). You can just copy and paste the code from one of the ASPs into your own file, or use the HTML #include file statement to bring in the proper report viewer code. If you ve set up a control on your application form that allows the user to choose a report viewer (similar to the viewer variable in the following example), you might use code similar to this to set the chosen report viewer:

 viewer = Request.Form("Viewer") 
If cstr(viewer) = "ActiveX" then
%>
<!-- #include file="SmartViewerActiveX.ASP" -->
<%
ElseIf cstr(viewer) = "Netscape Plug-in" then
%>
<!-- #include file="ActiveXPluginViewer.ASP" -->
<%
ElseIf cstr(viewer) = "Java using Browser JVM" then
%>
<!-- #include file="SmartViewerJava.ASP" -->
<%
ElseIf cstr(viewer) = "Java using Java Plug-in" then
%>
<!-- #include file="JavaPluginViewer.ASP" -->
<%
ElseIf cstr(viewer) = "HTML Frame" then
Response.Redirect("htmstart.ASP")
Else
Response.Redirect("rptserver.ASP")
End If

The sample report viewer ASPs for Java and ActiveX set certain viewer parameters to default settings. When you view the ASP code in these files, you ll notice parameters, such as group-tree display, toolbar button display, enabling of drill-down, and so forth, set with PARAM tags. You may modify this report viewer behavior if you so desire . If you want to make permanent changes to these options, simply change the sample ASP to use your new desired options (perhaps you don t want to offer a Print or Export button to your users at anytime ). If you want to hard-code a change only for a particular application, while others still use the defaults, you need to copy the code from one of the sample files into your own ASP file and change the parameter in your own file, or set session variables and modify the sample ASPs to look for them.

Look at the following sample code:

 <% 
If session("GroupTree") = "ON" Then
%>
<PARAM NAME="DisplayGroupTree" VALUE=1>
<%
Else
%>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<%
End If
%>

The <% and %> characters in the preceding code indicate separation of the server-side ASP script from the actual HTML text to be submitted to the browser. Because the parameters are part of the report viewer Object tag, they need to be returned to the browser, while the If-Then-Else statement will execute on the server. This separation of server-side script from client-side HTML is the basic premise of Active Server Pages.

What Is CleanUp.ASP?

CleanUp.ASP is a sample ASP that cleans up the three necessary session variables required by RptServer.ASP. By setting the three session variables to Nothing, resources on the web server are released. CleanUp.ASP is called by an HTML body tag s onunload event (via a JavaScript function), executing its code when a browser window containing the report viewer closes .

While you may use this sample ASP, you can also code your own procedures to clean up these objects by using alternatives, such as Session.Contents.Remove( < object name > ), or Session.Abandon (which will destroy all objects, not just your Crystal Reports objects).




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net