Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
stopping an element's rendering
osuwariboy
Hi everyone, I'm using Eclipse Indigo to design my BIRT reports and I'd like to know if it's possible to cancel an element's rendering given a certain condition? Hiding it is not enough, I really need to prevent an element from rendering if no data is returned from the database... because when there's no data for some reason, my report takes 5 minutes to render as opposed to 15 seconds when there's actually something to display (go figure).
Thanks in advance,
Osu
Find more posts tagged with
Comments
mwilliams
One thing you could do is to connect to your database and check the size of your query in the beforeFactory script of your report and then just drop the elements from your design, if there's no data.
osuwariboy
How do I do that in Eclipse? I found the BeforeFactory event, but how do I connect to the database and get the size of my query (especially since I'm using Stored Procedure here). I found:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getDesignHandle().getDataSets()
</pre>
<br />
I also have:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getDesignHandle().getBody().dropAndClear( reportContext.getDesignHandle().getElementByID(363) );
</pre>
<br />
which allows me to drop an element, but finding accurate documentation to actually use these functions is kind of difficult.<br />
<br />
Anyway, thanks in advance.<br />
<br />
Osu
mwilliams
For the connection to your database, I meant using JDBC/Java to connect to your database, run your query and determine the number of results. A plug-in was created in BIRT-Exchange's last plugin contest that aided you in doing this. You might look at it.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1428-birt-jdbc-oda-with-jdbc-resultset-override/
Or you could go directly after it and use the JDBC API:
http://docs.oracle.com/javase/tutorial/jdbc/basics/
As for dropping elements, if you simply name them in the property editor, by selecting the element, then going to the general section of the property editor and entering a name, you can drop them with:
reportContext.getDesignHandle().findElement("youElementName").drop();
You can put this in an if statement that checks the results of your dataSets and drop your elements if no data.
osuwariboy
My environment's not Java, it's PHP (I'm using PHP/JavaBridge to run my reports) so the JDBC API is pretty much out of my reach. Not to mention, wouldn't running the query before running the report essentially double the time it takes for the report to be generated? I mean, I'd have to run the query once to get the number of lines and then, when the report's launched, it would be run again by default.<br />
<br />
As for the plugin, when I try to checkout using my SVN tool and the provided URL, it says the URL doesn't exist so that too is out of my reach it seems. I've tried removing the extra space in the middle of the address, but that's a no go too. Besides, the project's page is rather empty, not giving any documentation on how to actually use the plugin
. I guess if I could actually download it, something would come with it, but I haven't even made it that far.<br />
<br />
So anyway, I'll stick with my current tactic of having my stored procedure return an empty line instead of nothing, which circumvents the problem that prompted this question in the first place: My report's slow when the resultset is empty, here's the corresponding post:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/25481-recordset-loaded-multiple-time/page__p__100587__fromsearch__1&#entry100587'>Recordset
loaded multiple times?</a><br />
<br />
So thanks anyway for the suggestions
.<br />
<br />
Osu
mwilliams
No, it shouldn't double your time. The rendering will take the majority of the time. It might increase it by a little to access the query twice, but it may not even be noticeable. However, it would most likely save you time in the case where no data is returned, as the query would not run the second time after dropping the elements from the design and they wouldn't be created or rendered either, saving even more time. If your way is working and time is not an issue, it should be just fine as is.
I do see now that the rusultSet ODA downloads are gone. I have emailed John about this to see why this is.
mwilliams
Try this location for the ResultSet ODA, instead, if interested:
http://www.birt-exchange.com/be/marketplace/app-showcase/?app=104
osuwariboy
Thanks for the link, though for some reason, the website won't accept my credentials even though I input the same as the ones I have for this forum. Aren't they both BIRT Exchange?
Also, I will have to disagree that the rendering takes up most of the time since the report takes about 15 seconds to appear when there's data, which is roughly about the same time it takes for my stored procedure to return its results. That's why I said that now, the report would take 30 seconds to run when there's data because you essentially have to call my stored procedure once to verify the content (15 seconds here) and another time to populate the datacubes (15 more seconds here for a total of 30).
I'll agree that in the event that there's no data, I'll have saved a lot of time since the datacubes will be dropped before they have a chance to query the dataset, thus giving me a render of 15 seconds. However, my "normal" rendering time will have climbed to 30 seconds.
Am I mistaken here? Is the dataset actually loaded twice? Anyway, I'm a bit confused here so please tell me if my reasoning is valid or not. Because if I'm right then I would honestly see no point in downloading the plugin.
Thanks in advance,
Osu
mwilliams
If your stored procedure takes 15 seconds to run, outside of BIRT, then yes, you're correct, it would take 30 seconds to do it twice. If your timing of the events is the time it takes to run your report using BIRT, then I disagree with you. From what I understood, you timed from pushing the button to run the report til when you got your results. If this is the case, I promise you that running your query took up just a very small portion of that. If you were to connect to your database from script, you might not even notice the change, or it would be minimal. The only actual way to find out for sure, is to try it. Though, if you're satisfied with your current results, I'd just leave it alone.
No, the dataSet is not loaded twice. I was only describing the scenario in which you connected to the data twice to check the resultSet size. I probably said it in a confusing way. Sorry. Also, I should have said creating and rendering the report takes the most time, meaning the time for BIRT to process your data and create the tables and render them. And yes, the marketplace should take the same credentials as your login, here. Hopefully I answered everything. If not, let me know.
osuwariboy
Yep, you did indeed answer all. And concerning my stored procedure, I did call it directly from the database and it took 15 seconds to return results.
Then, when I'm in Eclipse and I launch the report, it also takes roughly 15 (maybe 16 or 17) seconds to display the results, which is why I disagreed with you concerning the rendering of the report since both cases took about the same time to execute.
But anyway, my solution works and it's time for me to move on to other things at work
.
Thanks for your assistance.
Osu
mwilliams
Hmm. You must have a pretty simple report design if the data access takes the longest time!
In any case, I'm glad that you found a solutions that works for you. Good luck on your other work items and let us know whenever you have questions.
osuwariboy
Well, my report has three cross-tabs and that's pretty much it(one of which I believe you already saw from one of my other posts) so I don't know if you can consider this "simple" but hey, I can't very well argue with reality now can I lol
.