To download the CSP files from this tutorial, click TutorialSamples_vb.zip. For more information about using the samples, see Code examples.
<META HTTP
<!-- #include file=RetrieveIStore.csp -->
Function RetrieveReports(ParentID ,IStore, Error)
'This returns an HTML table that is populated with the report name,
'report description, and the last time it was modified.
'ParentID - The ID of the parent folder containing the reports to be retrieved.
'IStore - The InfoStore object required to interface with server.
'Error - A variable to hold the error if one occurs.
'Error - Contains the error number: 0 if successful.
'The function returns a string that is an HTML table.
'The query that will select the reports.
'A string to hold the HTML table.
'Create a query that selects all the reports, but doesn't select the instances.
query = "Select SI_NAME, SI_ID, SI_DESCRIPTION, SI_UPDATE_TS From CI_INFOOBJECTS Where " & _
"SI_PROGID='CrystalEnterprise.Report' And SI_INSTANCE=0 AND SI_PARENT_FOLDER=" & CStr(ParentID)
Set Result = IStore.Query(Query)
'There was an error querying the server.
HTMLTable="<TABLE Border=0 width = ""100%"">" & _
"<TR><TD><B>Name</B></TD>" & _
"<TD><B>Description</B></TD>" & _
"<TD><B>Last Modified</B></TD></TR>"
'Add the report name and details to the table
"<A HRef='ReportDescription.csp
"&FolderID=" & ParentID & "' Target='Main'>" & _
Server.HTMLEncode(oReport.Title) & "</A></TD>" & _
"<TD>" & Server.HTMLEncode(oReport.Description) & "</TD>" & _
"<TD>" & oReport.Properties("SI_UPDATE_TS") & "</TD></TR>"
HTMLTable=HTMLTable&"</TABLE>"
'Retrieve the CurrentFolderID from the file's parameter list.
CurrentFolderID = Request.QueryString("FolderID")
'Try to retrieve the InfoStore object.
If RetrieveIStore(IStore)=FALSE Then
'If it failed redirect, the user to the logon page.
Response.Redirect "LogonForm.csp"
HTMLTable= RetrieveReports(CurrentFolderID, IStore,Error)
Response.Write "<B>Report Listing</B><BR><BR>"
Response.Write "No reports..."
Response.Write "There was an error trying to retrieve the reports."
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |