To download the CSP files from this tutorial, click TutorialSamples.zip. For more information, see Code examples.
<META HTTP
<link REL=STYLESHEET TYPE='text/css' HREF='tut.css'>
<!-- #include file=helper_js.csp -->
<!-- #include file=RetrieveIStore.csp -->
// Constants that are used in RetrieveReportInformation's return values:
function RetrieveReportInformation(ReportID, IStore)
//This function retrieves the name and description of a particular report
//ReportID - The ID of the report currently being viewed.
//IStore - The InfoStore object required to interface with server.
//Error - A variable to hold the error if one occurs.
//Returns the name and description of the report in an array and null
//if the function did not succeed.
//The query that will select the report details.
//A query that selects report details.
Query = "Select SI_NAME, SI_DESCRIPTION From CI_INFOOBJECTS Where " +
Info[NAME]=Server.HTMLEncode(Result.Item(1).Title);
Info[DESCRIPTION]=Server.HTMLEncode(Result.Item(1).Description);
function RetrieveReportInstances(ParentID, IStore, LogonToken)
//This returns an HTML table that is populated with the instance name,
//description and the last time it was modified.
//ParentID - The ID of the parent report containing the instances to be retrieved.
//IStore - The InfoStore object required to interface with server.
//LogonToken - The user's logon token so that a link can be provided to view
//Returns an empty string if there are no instances, null if there was an error, and
//The function returns a string that is an HTML table.
//The query that will select the instances.
//A string to hold the HTML table in.
//Create a query that selects all the instances (SI_INSTANCE=1).
Query = "Select SI_NAME, SI_ID, SI_UPDATE_TS From CI_INFOOBJECTS Where " +
"SI_INSTANCE_OBJECT = 1 AND SI_PARENTID=" + ParentID;
HTMLTable="<table width = \"100%\"><TR><TH><B>Name</B></TH>" +
"<TH><B>Last Modified</B></TH></TR>";
//Add the instance name and details to the table.
//Ensure that each name is a link to the viewer.
oDescription = Result.Item(k);
"<A Target='_blank' href='viewrpt.cwr
"&apsToken=" + Server.URLEncode(LogonToken) + "' >" +
Server.HTMLEncode(oDescription.Title) + "</A></TD>" +
"<TD>" + oDescription.Properties("SI_UPDATE_TS") + "</TD></TR>";
HTMLTable=HTMLTable+"</table>";
function RedirectWithFrames(URL)
Response.Write ("<script language=javascript>open (\""+URL+"\",\"_top\");</script>");
var CurrentReportID, CurrentFolderID;
//Retrieve the CurrentFolderID from the file's parameter list.
CurrentReportID = Request.QueryString.Item("ReportID");
CurrentFolderID = Request.QueryString.Item("FolderID");
// Try to retrieve the InfoStore object.
// If it failed, redirect the user to the logon page.
RedirectWithFrames ("LogonForm.csp");
//This is the link back to the folder view listing all the reports.
Response.Write ("<a href='Reports.csp
"'><font size=
ReportInfo = RetrieveReportInformation (CurrentReportID, IStore);
Response.Write ("<H1>" + ReportInfo[NAME] + "</H1>");
//Draw the thumbnail in a table so that it has a border and scale
Response.Write ("<P><TABLE Width='100%'><TR VAlign='Top'><TD>" +
"<TABLE Border=1><TR><TD><CENTER><B>Preview</B></CENTER>" +
"<IMG Width=159 Height=206 SRC='ThumbNail.csp
//Response.Write "<P><TABLE Width='100%'><TR VAlign='Top'><TD>" & _
// "<TABLE Border=1><TR><TD><CENTER><B>Preview</B></CENTER>" & _
// "<IMG Width=159 Height=206 " & _
// "SRC=""thumbnail.csp
//Write the report's description.
Response.Write ("<TD>" + ReportInfo[DESCRIPTION] + "</TD></TR></TABLE>");
//Write out the instances associated with the report.
Response.Write ("<BR><H1>Instances</H1>");
//Retrieve the logon token so that the instances can be viewed in the report viewer.
LogonToken = GetCookie("LogonToken");
Instances = RetrieveReportInstances( CurrentReportID,IStore,LogonToken);
Response.Write ("<P>There are no instances of this report." +
" Schedule the report to create an instance of it.</P>");
Response.Write ("Error: I could not retrieve the instances of this report.");
//Write the links that enable the user to view, rename a schedule a report.
Response.Write ("<HR><CENTER><A Target=\"_blank\" HRef=\"viewrpt.cwr
CurrentReportID + "&APSToken="+Server.URLEncode(LogonToken)+"\"> View Report</A> - " );
Response.Write ("<A HRef='ChangeReportNameForm.csp
"&ReportName=" + Server.URLEncode(ReportInfo[NAME]) + "&FolderID="+ CurrentFolderID +
Response.Write (" - <A HRef='ScheduleForm.csp
"&FolderID=" + CurrentFolderID +" '>Schedule Report</A></CENTER>");
else Response.Write ("There was an error trying to retrieve the report details.");
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |