Adding an initialization string

You can also include an initialization string specifying the type of viewer to be used. This optional parameter may be written as init='ViewerType' where ViewerType may be any one of the following:

Be careful when using this parameter, however, since you need to know what type of browser the user is using.

Note:    If you wish to reconnect to the Page Server within the same browser session, you can append the CONNECT parameter to the initialization string. This allows the user to re-enter parameter values and logon information, as well as rerun the report if necessary.

The following function checks to see which browser the client is using: Netscape Navigator or Internet Explorer. It then selects either the Navigator plugin or the ActiveX viewer.

GetViewer function


Function GetViewer()

'Prompt for browser information.

Dim BrowseInfo

BrowseInfo = Request.ServerVariables("HTTP_USER_AGENT")

'If the browser is Internet Explorer then use ActiveX.

    If Instr(BrowseInfo, "MSIE") Then

        GetViewer = "actx"

    ElseIf Instr(BrowseInfo, "MSIE") = 0  Then

        'This is not Internet Explorer and should use the Navigator plugin.

        GetViewer = "nav_plugin"

    End If

End Function



The line to load the viewer may then be modified as follows:

"<a target='_blank' href='viewrpt.cwr?id=" & _

    "CurrentReportID & " & apstoken=" & Server.URLEncode(LogonToken) & "&init=" & GetViewer & "'> View Report</A>"

End of lesson

While this lesson may not cover everything there is to know about Report Viewers, it should give you a general understanding of how to load a Report Viewer and display a report.

For more information on Crystal Report Viewers, see Crystal Web Request (CWR).

For information on viewing reports that contain parameters, see .

Go to next lesson:

Lesson 3c: Renaming reports



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com