Letting users add comments to a Crystal Report after it has run
I had an interesting question from a new customer last week. They use Crystal Reports to analyse some data, but want users to be able to add comments to the report after it’s been run. No point adding them before, as the comments were a quote for work that was only known to be required after the report had run.
My initial thoughts were to just use the new parameter panel in Crystal 2008, that looks great until you look at the workflow imposed by the user interface. Click here, click there, type a bit, click a bit more, don’t forget to click the last button or nothing happens – ugh. Suggest whoever designed that bit looks up ‘cognitive walkthrough‘.
Instead, I went back to some code I wrote a couple of years ago. It’s a simple viewer application that just allow you to view and refresh reports. Simple addition of a button on the toolbar and a panel at the bottom. Click the button, panel appears, comments added, click OK – Bingo. The comments appear in the pre-defined section of the report. Hardest part was persuading the viewer to refresh its contents without refreshing all the data, otherwise the comment wouldn’t appear. Turned out to be two lines of code, you just have to find the right two lines!
Oh, forgot to mention, had to be in Korean too.
This customer only wanted the comment to be used for printing one time. What would be really interesting would be to have a continuing comment section that users could add to over multiple runs. Even more interesting would be to use the Enterprise SDK to allow users to add comments to instances after the report has been scheduled. I’d need to use a custom viewer to open the report using the Report Application Server (RAS) rather than the pageserver as the RAS SDK is much richer. Easy enough to change the report while it’s being viewed, slightly harder to save it back. Only part I’m not sure about is whether or not RAS would detect that the report had changed so needed to clear its cache. Turning off the caching isn’t too sensible due to performance. Restarting RAS every time isn’t too clever either! I need to dig around in the SDK to find if anything is in there – one for the Christmas break methinks.