.net application displaying report as pdf from CE runs slowly
I have inherited a .Net application that does the following:
' create the parameter objects Dim objVal As CrystalDecisions.Enterprise.Desktop.ReportParameterValue ' create a report object Dim objReport As CrystalDecisions.Enterprise.Desktop.Report ' create an infoobject object and an infoobjects collection Dim objInfoObjects As CrystalDecisions.Enterprise.InfoObjects Dim objInfoObject As CrystalDecisions.Enterprise.InfoObject ' set the item id of the enterprise item object to the value of the report ceeiReport.ItemID = strRpt ' change the type of the enterprise item from infoobject to report and assign it to the report object objReport = CType(ceeiReport.InfoObject, CrystalDecisions.Enterprise.Desktop.Report) ' create a scheduling object to create a scheduled instance of the report Dim objSI As CrystalDecisions.Enterprise.SchedulingInfo objSI = objReport.SchedulingInfo objSI.RightNow = True objSI.Type = CrystalDecisions.Enterprise.CeScheduleType.ceScheduleTypeOnce Dim objFormats As CrystalDecisions.Enterprise.Desktop.ReportFormatOptions objFormats = objReport.ReportFormatOptions objFormats.Format = CrystalDecisions.Enterprise.Desktop.CeReportFormat.ceFormatPDF
Next, the code (omitted from here) goes through some gyrations to assign values to the parameter object. Then, it schedules the report:
And then it begins querying the CE database waiting for the report to complete:
Do Until strRunning = "3" strQuery = "select * From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise." & strSI_PROGID & "' and SI_ID = '" & objReport.Properties("SI_NEW_JOB_ID").ToString & "'" objInfoObjects = ceidUser.InfoStore.Query(strQuery) strRunning = objInfoObjects.Item(1).SchedulingInfo.Properties.Item("SI_PROGRESS").ToString OneSecondDelay() Loop
Once the report completes successfully, the query finds the finished report and returns it to the code to be displayed as pdf:
Dim objExport As CrystalDecisions.Enterprise.Desktop.Pdf objExport = CType(objInfoObject, CrystalDecisions.Enterprise.Desktop.Pdf) Response.ClearContent() Response.ClearHeaders() Response.ContentType = objExport.MimeType Response.BinaryWrite(objExport.ByteStream) objExport.Dispose() Response.Flush() Response.Close()
Everything is working correctly, in that the page loads and the pdf is displayed. My problem is that the pdf takes about 3 minutes to display.The report itself only takes a few seconds to load in the Crystal Reports designer, or when run manually through the Crystal Management Console. I have debugged the code and found that the hang up is in CE scheduler. I can log into Crystal Management Console, navigate to the Reports History tab and see the instance of the report that has been created by this code. It sits there in "Pending" status for about 3 minutes. Then, the status switches to "Running" for a few seconds. Then it switches to "Success" when it is complete. Immediately after completion, the pdf displays in the browser as expected.
Does anyone have any idea why the scheduled job hangs in "pending" status for so long? Is there a setting in CE that needs to be changed?
Thanks in advance...
Former Member replied
Since the report is sitting in Pending status for 3 minutes after it's scheduled you might check the time on the web app server and the Enterprise server to see if they're in synch. If not, synch them back up and check the Pending behavior.