Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Don't generate an empty report(need to cancel rendering of a blank pdf)
Don't generate an empty report [message #1117503] Thu, 26 September 2013 14:11 Go to next message
Todd Eidson is currently offline Todd EidsonFriend
Messages: 3
Registered: September 2013
Junior Member
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 #1117825 is a reply to message #1117503] Thu, 26 September 2013 21:15 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

What are you calling to generate the report? A servlet? Do you control the code used to execute the report? Do you know if it's using separate run and render tasks? You might be able to modify your class to no run the render task if you pass out a variable through the app context or something. Not sure. Never tried it.

Michael

Developer Evangelist, Silanis
Re: Don't generate an empty report [message #1118549 is a reply to message #1117825] Fri, 27 September 2013 14:19 Go to previous messageGo to next message
Todd Eidson is currently offline Todd EidsonFriend
Messages: 3
Registered: September 2013
Junior Member
Thanks for the reply.

I'm using php to launch a shell command that calls the genReport.sh like this:

./genReport.sh -f PDF -o reportName.pdf -F reportName.rptdesign

I know that that genReport.sh defaults to run and render, but would also allow me to launch the run and render separately. That is an idea that crossed my mind, but I was unsure of how to execute it from there...

I have programmed in Java before (long before) and realize that I could have a lot more flexibility if I were to use Java, which is what I plan to do in the future, but I think it would take me too long to get up to speed to meet the deadline.
Re: Don't generate an empty report [message #1138430 is a reply to message #1118549] Tue, 15 October 2013 05:05 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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.


Michael

Developer Evangelist, Silanis
Previous Topic:Is there a BIRT emitter for JSON (or charts that render JSON strings)
Next Topic:unwanted gap between cell contents and cell boarder
Goto Forum:
  


Current Time: Fri Mar 29 00:27:32 GMT 2024

Powered by FUDForum. Page generated in 0.03262 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top