Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Canceling rendering when resultset is empty
Canceling rendering when resultset is empty [message #1661733] Mon, 09 March 2015 19:21 Go to next message
osuwariboy Mising name is currently offline osuwariboy Mising nameFriend
Messages: 24
Registered: December 2010
Junior Member
Hey there,

We have a report containing a lot of complex logic that generates just fine when there's data to be rendered, but throws a plethora of exceptions when someone gives it parameters that don't return anything. The errors are mainly all "Column XXX doesn't exist"... which makes sense considering there's no data to actually create the dataset.

Now, I know I can do something like this to just drop an element from my report design:

var myelement = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("myElementName");

myelement.drop();


The problem is that this code works in the beforeFactory... but at this point, I don't know whether I have results or not. The place I think would work is the onFetch event, but wouldn't it be too late then to drop an element? Also, how would I know whether the resultset is empty or not?

Finally, my reports run from a PHP script passing through JavaBridge and the rptdesign themselves are calling Esproc files to get their data. With such a setup, I'd like to know what I can do to solve this problem.

Thanks in advance,

Osuwariboy
Re: Canceling rendering when resultset is empty [message #1663699 is a reply to message #1661733] Tue, 10 March 2015 14:55 Go to previous messageGo to next message
Jesse Freeman is currently offline Jesse FreemanFriend
Messages: 184
Registered: January 2015
Senior Member
You could use the Design Engine API (DEAPI) to query the data set and iterate through the result set to see if there is data. Then you can perform your desired logic to drop elements and what not based on the results.

[Updated on: Tue, 10 March 2015 17:27]

Report message to a moderator

Re: Canceling rendering when resultset is empty [message #1668489 is a reply to message #1663699] Thu, 12 March 2015 14:08 Go to previous messageGo to next message
osuwariboy Mising name is currently offline osuwariboy Mising nameFriend
Messages: 24
Registered: December 2010
Junior Member
I know next to nothing about the DEAPI. Whatever snippets I could gather, were either copy-pasted from other threads on this forum or through luck/deduction. In this case, I'd like a bit more of a specific answer:

1) You say I could access the dataset using the DEAPI... how exactly can I do that? I have no idea what code to write in order to successfully access the dataset through this API.

2) Even if I know what to write... where do I write it? Do I put it in the beforeFactory of the rptdesign? Do I put it somewhere else? Keep in mind, my pages are actually PHP, so any Java I want to put is always a nightmare to write.

Anyway, thanks in advance.

Osuwariboy
Re: Canceling rendering when resultset is empty [message #1668662 is a reply to message #1668489] Thu, 12 March 2015 15:40 Go to previous message
Jesse Freeman is currently offline Jesse FreemanFriend
Messages: 184
Registered: January 2015
Senior Member
You can use DEAPI to query the data set just about any where within the report design. A common place to do this is in the beforeFactory due to how early in the generation processes this runs.

Take a look at this DevShare on using DEAPI in the beforeFactory of a report design: http://developer.actuate.com/community/forum/index.php?/files/file/822-data-engine-api-to-check-data-set-values/

I have also attached a sample report with a modified version of this code that demonstrates some various ways and places to use DEAPI to query a Data Set in a report design.
Previous Topic:Cotumising birt parameter
Next Topic:Setting JVM memory through Java code for Standalone BIRT engine
Goto Forum:
  


Current Time: Sat Jul 20 13:04:33 GMT 2024

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

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

Back to the top