Creating the main CSP page

The main CSP page defines the frames for the viewer, and loads both the viewer and the toolbar from your custom desktop. It accepts a minimum of one parameter: the ID of the report you wish to view. Create a new text file called MyViewer.CSP and save it. The page may look something like this.

Example


<% @language=JavaScript %>

<HTML>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<!-- #include file=helper_js.csp -->

<title>Crystal Report Viewer</title>

<SCRIPT src="htmlviewer.js"></SCRIPT>

<frameset frameborder="0" rows="64,*" >

<frame name="CrystalViewerToolbar" src="MyToolbar.html">

<%

var ReportID;

try

{

var SessionManager = Server.CreateObject("CrystalEnterprise.SessionMgr");


// Enter your own user ID here.


var UserID = "Administrator";


// Enter your own password here.

var Password = "";

// Enter your own APS name here.

var APS = "LCONNORS02";

var Aut = "secEnterprise";

var Sess = SessionManager.Logon(UserID,Password,APS,Aut);

  // Retrieve the report id from the URL string.

  ReportID = Request.QueryString("ReportID");

  // Load the viewer with the Report ID

  Response.Write("<frame name='CrystalViewerPreview' src='viewrpt.cwr?" +

    "cmd=preview_page&incomplete_page_count=1&viewer=html_frame& " +

    "vfmt=html_frame&page=1&brch=&drillname=&subrpt=&id=" & cstr(ReportID) + "&APSToken=" +

    Sess.LogonTokenMgr.CreateLogonToken(APS,300,300) & "'>");

}

catch(e)

{

    Response.Write("Error");

};


%>

</frameset>

</html>



Remarks

This page accomplishes three important things:

This file will be the one that your custom desktop calls when loading your custom viewer. For example, a link in your custom desktop may read as follows.

<A HREF='MyViewer.csp?ReportID='" & AnID & "'>View Report</A>

Go to next step:

Creating a Custom Toolbar



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