While Crystal Enterprise is not designed to manipulate reports themselves or compile web pages that perform complicated administrative tasks, it does allow some basic write functionality. Simple things such as scheduling information and report and folder properties may be written to the server.
In this section, you'll provide a link that enables the user to change the name of a report. This will be accomplished by two pages: the first will gather the required information from the user, and the second will change the name of the report and write the new one back to the server.
The first page is a form that gathers information from the user. It takes three parameters:
NewReportName
displayed as the default in the text box
ReportID
used to change the name of the report
CurrentFolderID
ensures the View Folder Contents link will work properly when the report details page is reloaded.
Once the new name has been entered by the user, the data is transferred to the page named RenameReport.csp along with the report's ID and the CurrentFolderID
. The name is changed and the user redirected to the page detailing the current report.
Renaming a report requires you to do the following:
InfoStore
.
Function ChangeReportName(ReportID ,IStore, Error, NewName)
'This function changes the name of a report given its
'ReportID - The ID of the report.
'NewName - The new name for the report.
'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 query that will select the name of the report.
'Retrieve the current name of the report.
Query = "Select Top 1* From CI_INFOOBJECTS Where " & _
Set Result = IStore.Query(Query)
'There was an error querying the server.
'Write the result back to the APS.
'Check if the write was successful.
The function reads the name of the report (SI_NAME), changes the name, and commits the changes to the server. If this is done successfully, then the user is redirected to the Report Details Page; otherwise an error message is displayed.
You have reached the end of the lesson. What follows are two complete CSP pages: the first page, ChangeReportNameForm.csp, is a form that allows the user to modify the name of a report, and the second page, RenameReport.csp, writes the new name to the server.
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |