Wednesday, July 23, 2008

Frustrations with Crystal Reports

Whenever I'm asked my opinion of Crystal Reports I always respond the same way: It's an easy to learn, flexible reporting tool that works extremely well 98% of the time; but the other 2% of the time it's a real bear.

Recently, I witnessed CR in all of its bear-ish glory. At one of my clients, we typically export our Crystal Reports to pdf format when rendering reports from web applications (we've found over time that this works much more smoothly than rendering the reports through an ActiveX viewer). The export procedure is made fairly simple using the Crystal .Net objects that ship with most versions of Visual Studio 2003/2005/2008.

We've been successfully exporting our reports to pdf for web applications for the last 3 years or so with no major problems, but recently we began receiving the non-descriptive error of: "Failed to Export the Report". We received this error on every report that we tried to render through our web applications.

The first thing that I checked was to see if I could manually export the report to pdf locally on the web server (which has Crystal Reports 8.5 installed). That worked flawlessly.

After Google-ing for the error message and sifting through many forum posts and responses, I finally saw where someone suggested checking available disk space on the C drive because Crystal creates temporary files on each export and has no built-in procedure for clearing out those temporary files. We had plenty of disk space available, but I did notice a ton of crystal files in our temp directory (c:\Documents and Settings\LOGINID\Local Settings\Temp).

I retried the export functionality after clearing the temp files, and I began receiving another error message: "Dos Error". I guess you really couldn't hope for anything more descriptive than that, huh?

I scratched my head for a few seconds and thought that maybe deleting the temporary files from the temp directory under the user's profile was to blame, and that, perhaps, logging off and back on to the user's profile would resolve any issues there. Bingo. The code began working like a charm again.

So, in the end it was all a matter of clearing out the temporary files cache, but wouldn't you think that would be built into the Crystal framework? Or worst case, you would think that the export would work regardless of the number of temp files in the directory. Oh well, these are the types of things that make Crystal Reports a major headache sometimes.

If anyone knows of a better reporting tools please let me know!

0 comments: