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)
Hiding table when subtables have no data
paulk
I have a table that contains 4 sub-tables. The 4 sub-tables are not directly related to each other.
I would like to hide the table when all 4 sub-tables have 0 records.
What would be the best way to accomplish this?
I'm using 2.3.2
Thanks.
Find more posts tagged with
Comments
mwilliams
Hi paulk,
Are all of your tables created with separate dataSets?
paulk
Yes, each table uses a separate dataset.
mwilliams
paulk,
Ok, take a look at this report. I initialized a variable in the initialize method of the report. I then increment this variable in the onFetch of each of the 3 dataSets I have. I then check this variable in the visibility statement of the outer table. If the variable hasn't been incremented, then that means there is no data because the onFetch method was never called, so the whole table is hidden. If you'd like, you could have the opposite visibility statement on a label that says "No data was returned" so that the user sees something when there is no data.
Hope this helps.
paulk
I looked at your report but I see a problem with using this method.
I added logging to the report and logged the events for each data set and the table visibility. The where condition of the datasets were removed to ensure the onFetch events were called. The table visibility expression is evaluated before the onFetch events for the subtables are executed. First few lines of my log file:
CUSTOMER.beforeOpen
CUSTOMER.afterOpen
CUSTOMER.onFetch
Table Visibility Expression
CUSTOMER.onFetch
Table Row Visibility Expression
ORDER.beforeOpen
ORDER.afterOpen
ORDER.onFetch
Subtable Visibility Expression
ORDER.onFetch
The top down execution of BIRT certainly causes a few problems.
I did realize that I don't need to hide the whole table, just rows of data in the parent table. I'll try to explain better what I'm trying to accomplish. For each customer, I want to display their name, orders and payments. If a customer has 0 orders and 0 payments, I do not want to display that customer or their name on the report.
I have attached a modified report and my log file from running the report. For example, customer 125 has no orders/payments and I would like to not display their customer information. (The folder 'C:\work' must exist for the log file to be created)
A possible solution I see is creating a single dataset out of the 5 tables using some messy query and base the table on this dataset.
mwilliams
Well, here's A solution. Not sure if it's an ideal one, but it gets rid of what you don't want to see. Let me know if you have questions.
paulk
Very nice! I think that will work well.
Thank you.
mwilliams
Not a problem. Let us know whenever you have questions!