Don't generate an empty report [message #1117503] |
Thu, 26 September 2013 10:11  |
Eclipse User |
|
|
|
I have several Birt Reports that I am trying to set up to run on a cron job that will email pdfs of the reports every morning. Everything is working fine as far as the generation and emailing goes; the only issue I am stuck with is this: if there is nothing to report, a pdf with just the report title is generated and emailed (a blank report, basically). I'd like to stop this report from being generated at all, so i can skip the emailing, if the pdf file does not exist.
I have been all over Google for two days now, and the closest I can find is this: http://www.eclipse.org/forums/index.php/t/458779/ in which someone was trying to solve a similar problem and received a push in the right direction, but not a complete solution.
It appears as if this can be done during the beforerender script... but how? I know I need to:
1.set a persistent global variable in the oncreate if there is indeed data to report.
2.get the persistent global variable in the beforerender script.
3.send the magic don't generate report command.
I'm doing all of generating and emailing from a php script, not Java, so I can't send commands like IEngineTask.cancel() (or can I???)
Yes, I know I can make a row in the report that says "No data to report", but that's not what my users want.
And yes, I could query the database outside of the report to determine if there is valid data to report or not, but i'd prefer not to.
And maybe I could even open and read the pdf, programmatically to see if there is anything there, but that sounds like more of a hassle than it's worth...
So, how do I do this?
Thanks.
|
|
|
|
|
Re: Don't generate an empty report [message #1138430 is a reply to message #1118549] |
Tue, 15 October 2013 01:05  |
Eclipse User |
|
|
|
Sorry for the delay. There are several examples around showing how to write a class that uses separate run and render tasks. Here is a link to an example from the wiki on this site:
http://wiki.eclipse.org/Separate_Run_and_Render_(BIRT)_2.1
If you have any questions getting this working, feel free to ask.
As for the genReport, you might try running just the "run" task and then check the .rptdocument for any data before running the "render" task. I've not tried to do this before, so I'm not sure if it'll work.
|
|
|
Powered by
FUDForum. Page generated in 0.04226 seconds