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)
Count detail rows per page?
roopurt81
I have a report with a table and a couple of groups:
Group: DeptCd
Group:
VehicleCd
Detail:
Detail1---Detail2---Detail3---Etc.
In reality I do not have any data or labels in the group headers; it is all laid out in the detail like so:
Detail: DeptCd---VehicleCd---Detail1---Detail2---Detail3---Etc.
Now I want to do the usual: Hide DeptCd and VehicleCd whenever they're not changing.
The catch is I want to do this conditionally for only some output formats. For PDF, HTML, and DOC I want them hidden where appropriate. For XLS I want them displayed for every row regardless.
I know about "Suppress Duplicates," but I do not think it will work appropriately in this case.
I do not like to use the data in the group headings with the "Drop to detail" feature because the vertical alignment is incorrect in PDF format.
In any case, with both "Suppress Duplicates" and "Drop to detail" they will only show for the first item in the group. I want them to show whenever it is the first item in the group ~or~ whenever it is the first detail row on a page.
If there is any way I can count the number of detail rows per page, then I think I can accomplish this. But for the life of me I can not find any method to get a running total of the rows on a page.
Can anyone help with this?
Find more posts tagged with
Comments
mwilliams
Hi roopurt81,
You should be able to increment your own variable in the onCreate script of the row and reset the variable in the onPageBreak script of the table. You could then use this variable to set the visibility of the item in your detail row. Hope this helps. Let me know if I'm not understanding correctly or if you have questions.
roopurt81
Michael,
Thank you for your response and my own original thinking was very similar. However due to the order of event firing this does not seem possible.
Using the "Birt Help" manual I was able to add logging to my report at every possible event (well, I think I logged all of them).
Here is the output. The increasing integer at the end of each line is the report variable that I am incrementing on the onCreate() handler for the detail rows.
ReportDesign.initialize
table.onCreate: 0
table.onRender: 0
table.Header.row.onCreate: 0
table.header.row.onRender: 0
table.grp_dept_cd.onCreate: 0
table.grp_dept_cd.onRender: 0
table.grp_dept_cd.header.row.onCreate: 0
table.grp_dept_cd.header.row.onRender: 0
table.grp_vehicle_cd.onCreate: 0
table.grp_vehicle_cd.onRender: 0
table.grp_vehicle_cd.header.row.onCreate: 0
table.grp_vehicle_cd.header.row.onRender: 0
table.detail.row.onCreate: 1
table.detail.row.onRender: 1
table.detail.row.onCreate: 2
table.detail.row.onRender: 2
table.detail.row.onCreate: 3
table.detail.row.onRender: 3
### ROWS 4 THROUGH 33 SNIPPED
table.detail.row.onCreate: 34
table.detail.row.onRender: 34
table.detail.row.onCreate: 35
table.detail.row.onRender: 35
table.detail.row.onCreate: 36
table.detail.row.onRender: 36
### LAST ROW ON PAGE 1
table.grp_vehicle_cd.footer.row.onCreate: 36
table.grp_vehicle_cd.footer.row.onRender: 36
table.grp_vehicle_cd.onCreate: 36
table.grp_vehicle_cd.onRender: 36
table.grp_vehicle_cd.header.row.onCreate: 36
table.grp_vehicle_cd.header.row.onRender: 36
table.detail.row.onCreate: 37
table.detail.row.onRender: 37
table.detail.row.onCreate: 38
table.detail.row.onRender: 38
# ROWS 39 THROUGH 74 SNIPPED
table.detail.row.onCreate: 75
table.detail.row.onRender: 75
table.detail.row.onCreate: 76
table.detail.row.onRender: 76
# LAST ROW ON PAGE 2
table.detail.row.onCreate: 77
table.detail.row.onRender: 77
table.detail.row.onCreate: 78
table.detail.row.onRender: 78
# ROWS 79 THROUGH 114 SNIPPED
table.detail.row.onCreate: 115
table.detail.row.onRender: 115
table.detail.row.onCreate: 116
table.detail.row.onRender: 116
# LAST ROW ON PAGE 3
table.detail.row.onCreate: 117
table.detail.row.onRender: 117
table.detail.row.onCreate: 118
table.detail.row.onRender: 118
# ROWS 119 THROUGH 154 SNIPPED
table.detail.row.onCreate: 155
table.detail.row.onRender: 155
table.detail.row.onCreate: 156
table.detail.row.onRender: 156
# LAST ROW ON PAGE 4
table.detail.row.onCreate: 157
table.detail.row.onRender: 157
# DETAIL AND GROUPS FROM 158 TO 298 SNIPPED
table.detail.row.onCreate: 299
table.detail.row.onRender: 299
table.detail.row.onCreate: 300
table.detail.row.onRender: 300
table.detail.row.onCreate: 301
table.detail.row.onRender: 301
table.grp_vehicle_cd.footer.row.onCreate: 301
table.grp_vehicle_cd.footer.row.onRender: 301
table.grp_dept_cd.footer.row.onCreate: 301
table.grp_dept_cd.footer.row.onRender: 301
table.footer.row.onCreate: 301
table.footer.row.onRender: 301
report.onPageStart: 301
masterpage.onPageStart: 301
table.onPageBreak: 301
table.grp_dept_cd.onPageBreak: 301
table.grp_vehicle_cd.onPageBreak: 301
table.grp_vehicle_cd.onPageBreak: 301
table.grp_vehicle_cd.onPageBreak: 301
masterpage.onPageEnd: 301
report.onPageEnd: 301
report.afterRender: 301
report.afterFactory: 301
I've added comment-lines starting with a triple-hash (###) to indicate what the last record on each page is and where the page breaks occur.
As you can see, except for the occasional group end / begin events, there is nothing but a sea of onCreate() and onRender() methods. I can not see anything I can latch onto to determine the row number per page.
roopurt81
I wasn't able to accomplish what I wanted, but I did reach a nice compromise.
I added the DeptCd and VehicleCd into the group headers.
I also added them into the detail.
For non-XLS output, I show the group headers and hide the detail elements.
For XLS output, I hide the group headers and show the detail.
The group headers are not dropped into the detail because of the vertical alignment issue I mentioned earlier. But they're big and bold like you'd expect h1 and h2 tags to be on an HTML page so they don't look out of place.
mwilliams
roopurt81,
If you can recreate your issue with the sample database, maybe I can see better what you're talking about and be able to help more to do it the original way you wanted. Let me know.