I have inherited a .Net application that does the following:
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:
Once the report completes successfully, the query finds the finished report and returns it to the code to be displayed as pdf:
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. I have debugged the code and found that the hang up is in CE. 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?
Thanks in advance...
mwa
<><
Code:
' 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
Code:
ceeiReport.Schedule()
Code:
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
Code:
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()
Does anyone have any idea why the scheduled job hangs in "pending" status for so long?
Thanks in advance...
mwa
<><