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)
Hide table if the content is empty
myklynysh
Hello,
is there in Birt any possibility to set the element invisible, if the content of the element (like table or chart) is an empty set.
I would like to set a pie chart to invisible, if it has only one section (single colour pie chart). Is there any way to check the state of chart before rendering?
Thanks in advance.
Find more posts tagged with
Comments
mwilliams
Hi myklynysh,
To hide a report element if there is no data in your result set, you could create a variable with a value of 0 in your initialize method of your report, increment the variable in the onFetch method of your dataSet, and then use this value to hide your chart/table if the value of the variable is 0 (this would mean that the onFetch was never called because there was not data to be retrieved).
Hope this helps.
myklynysh
Hello Michael,
thanks for your answer. But his approach is only applicable for report composition with Java. If I have a rpt-design document created with Birt Eclipse plug-in. Can I insert that kind of check-up to set empty table to invisible?
SailRCG
Hi myklynysh,
I've attached an example of what Michael describes in his response.
The report has variables (look in the 'Script' outline) and uses those to determine if there are fewer than two records returned in the Data Set.
The report uses the Classic Models database, and has a dropdown list for values. Initially run the report selecting "All" and you will see a table of elements and corresponding Pie-Slices. Select "Starts with 'T'" and you'll see the Trains and Trucks, for two Pie-Slices. Finally pick any of the other choices, and you'll see a table of only ONE Record and no pie chart.
Hope this helps,
RG.
Helmut
<p>Have a look at this blog <a data-ipb='nomediaparse' href='
http://digiassn.blogspot.com/2007/03/birt-hide-report-table-when-no-data-is.html'>http://digiassn.blogspot.com/2007/03/birt-hide-report-table-when-no-data-is.html</a></p><p>It
shows in a simple way to hide tables and even to show the "No Data" message.</p><p> </p><p>A preview: Set Visibility Expression of table to "(Total.count() < 1)"</p>