Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Throw an ExceptionError by the number of DataSet result
Kenichi
Dear, Birt Experts
Is there anyway to throw/raise the exception error if the DataSet returns no result?
I am working on the report which requires to pass parameters of date range (ie. 2011-06-10 to 2011-06-20). If my SQL on DataSet returns no value (or zero value), I would like to throw an exception error, and let user knows that the passing parameter does not hit any record.
My problem is that if DataSet returns no value, report layout is always blank. However, the contents on header or footer of master page always appears on report.
Thanks for your support.
Ken
Find more posts tagged with
Comments
mwilliams
Hi Ken,
You could put something like DSrows=0; in your initialize method, then, in the onFetch of the dataSet, put DSrows=1;. If there is a row in your dataSet, DSrows will change from 0 to 1. Now, you can use this variable in a visibility expression on your table to hide it if DSrows is still 0. Additionally, you can have a label in your report that says something like, "The parameters selected returned no results, please expand your range.". Then, you can use a visibility expression for this label that only shows it if DSrows is still 0. Hope this helps.
Kenichi
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79719" data-time="1310042982" data-date="07 July 2011 - 05:49 AM"><p>
Hi Ken,<br />
<br />
You could put something like DSrows=0; in your initialize method, then, in the onFetch of the dataSet, put DSrows=1;. If there is a row in your dataSet, DSrows will change from 0 to 1. Now, you can use this variable in a visibility expression on your table to hide it if DSrows is still 0. Additionally, you can have a label in your report that says something like, "The parameters selected returned no results, please expand your range.". Then, you can use a visibility expression for this label that only shows it if DSrows is still 0. Hope this helps.<br /></p></blockquote>
<br />
<br />
Thanks, Mr mwilliams<br />
<br />
The way you addressed perfectly made sense to me. <br />
<br />
However, is there anyway to populate the error message by popup window, and stop the report execution immediately by raising an exception?
mwilliams
Unfortunately, by the time you have access to the number of returned rows from within BIRT, you're already executing the report and I don't think that there's a way to stop it. I could be wrong on this, though.
Kenichi
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="79777" data-time="1310070195" data-date="07 July 2011 - 01:23 PM"><p>
Unfortunately, by the time you have access to the number of returned rows from within BIRT, you're already executing the report and I don't think that there's a way to stop it. I could be wrong on this, though.<br /></p></blockquote>
<br />
<br />
Thanks, Mr. mwilliams for your support again.<br />
Best,