Strange Crystal Report Problem
I've seem crazy strange problem in all sort of development tools, but to me this one is a bit too strange.It started a week ago when the user of our system started to report problem of generating .csv file from our Crystal Report Queue engine (a .Net based application, but I have a very strong feeling that the Crystal Report component that the Queue engine called is actually a COM component). It returns the following error:
-------------------------------------------------------------------
Program starts at time: 22/05/2006 下午 02:59:44
Starting: Report Queue ID= 1310, Report ID= RF3502
CrystalDecisions.CrystalReports.Engine.FormulaException: A number field or currency amount field is required here.
Details: errorKind
Error in File C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\3\{1C97FE58-5BC0-4635-8208-08399CF0C2F7}.rpt:
Error in formula
'Sum({@UNIT_PRICE_SA})'
A number field or currency amount field is required here.
Details: errorKind ---> System.Runtime.InteropServices.COMException (0x80041019): A number field or currency amount field is required here.
Details: errorKind
Error in File C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\3\{1C97FE58-5BC0-4635-8208-08399CF0C2F7}.rpt:
Error in formula
'Sum({@UNIT_PRICE_SA})'
A number field or currency amount field is required here.
Details: errorKind
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- 內部例外堆疊追蹤的結尾 ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
at ReportQueueHandler.ReportClass.genRpt() in ReportQueueHandler.vb:line 1275
Oracle.DataAccess.Client.OracleException ORA-00942: 表格或視觀表不存在 at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)
at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
at ReportQueueHandler.ReportClass.BackToPending() in ReportQueueHandler.vb:line 1342
Program ends at 22/05/2006 下午 02:59:47
-------------------------------------------------------------------
In fact, sometimes the .csv export can actually crash the Report Queue, and suck up at most 900Mb of memory. And I was like, "what the hell is that".
After looking up and down, I finally found out the reason, which I think is more of a Crystal Report bug since the problem only occurs when user generate .csv file. PDF report was generated properly.
The problem is this: if a report contains any Number field that has script entered in the "Disply String" script box (brought up by right click on the field and select "Format Field ..."), the .csv generation will fail.
My solution is to stop using the "Disply String" script box to format a field. Instead I create another Formula field with String type, and then reference the original Number field in the formula script.
That works very well.
