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)
Resetting a Aggregation Item for every Page
vensw
Hi,
I have inserted an Aggregation Item(called RowCount) in the table and assigned the function RUNNINGCOUNT and gave the "Aggregate on:" option as Table. I'm giving the expression "BirtMath.mod((row["RowCount"]),5)!=0" to display a horizontal line after every 5 rows in the page. In the first page, I can see there are in total of 28 rows. In the second page, I got the horizontal line after 2 lines(2line in the 2nd page + 3 lines in the previous page = 5 line) and then after every 5 rows. How can I reset the RowCount to Zero when the data is continuing to the next page? Kindly, help me and provide me the detailed steps to acheive this. Thanks in Advance.
Regards,
EVS.
Find more posts tagged with
Comments
mwilliams
You could just keep your own running count in script and set the line under it based on every count of 5 of this variable. Then, reset this variable in the onPageBreak script.
vensw
I'm actually new to BIRT.. I haven't explored much yet. Could you please elaborate in detail? Thanks in advance.<br />
<br />
EVS<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78288" data-time="1307656388" data-date="09 June 2011 - 02:53 PM"><p>
You could just keep your own running count in script and set the line under it based on every count of 5 of this variable. Then, reset this variable in the onPageBreak script.<br /></p></blockquote>
vensw
Say, I have the variable called "RowCount" and I used the expression "BirtMath.mod((row["RowCount"]),5)!=0" in the visibility option of the detail row(in which I have set the line), what needs to be written in the script editor to reset the RowCount to Zero?
Regards,
EVS.
mwilliams
If you had a variable named RowCount and set it to 0 in your report's initialize method (RowCount=0;), then incremented this variable in the onCreate of the detail row of your table (RowCount++;), then used the variable to check for every 5th row, then to reset it for the next page, you'd go to the onPageBreak event and reset it (RowCount=0;). Let me know if you need further explanation or an example.
vensw
Guru,<br />
<br />
Where can I find the intialize() method?? <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
All I can see in the script tab are the onPrepare(), onCreate(), onRender(), and onPagebreak(). Please help me and thank you very much for your timely help.
<br />
<br />
Regards,<br />
EVS
mwilliams
The initialize method can be found by clicking in an empty spot in the report design and then going to the script tab under the design window.
vensw
@ Guru,<br />
<br />
When you said variable, does that mean Aggregation Item or the Data item?? <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
I have assigned the function RUNNINGCOUNT and gave the "Aggregate on:" option as Table for the RowCount aggregation Item. How does that work in this case??
mwilliams
If you look at my explanation above, you'll see I wrote in () what to put in each script method. You won't use an aggregation in this way, you'll do your own count of rows.
vensw
Guru,
An example in 2.3.2 version would be really helpful..
Thanks!!
EVS
vensw
Guru,<br />
<br />
An example in 2.3.2 version would be really helpful..<br />
<br />
Thanks!!<br />
EVS <br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78415" data-time="1308000415" data-date="13 June 2011 - 02:26 PM"><p>
If you look at my explanation above, you'll see I wrote in () what to put in each script method. You won't use an aggregation in this way, you'll do your own count of rows.<br /></p></blockquote>
mwilliams
Take a look at the example. In 2.3.2, you'll have to have a page break interval set or force the onPageBreak event to be called somehow as it doesn't get called on physical page breaks in PDF. In 2.6.2, this is not the case. Hope this helps. Let me know if you have questions. Be sure to run this in PDF, there is another bug that causes the border lines on the rows not to show up in the preview or web viewer.
vensw
Guru,<br />
<br />
Thank you for your reply. I tried your example and I found the same problem with your solution too.<br />
Luckily, there are 30 or 35 rows rendering in your first page of pdf. So the line will look like it is appearing after every 5 rows and also looks like the logic is resetting the myRowCount to zero after every page break. If you make sure the number of rows in the frist page is not a number which is exactly divisible by 5, you will find out what is going wrong in the 2nd page. Let me know if I made any sense to you. Thank you again for your time and patience.
<br />
<br />
Regards,<br />
EVS <br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78418" data-time="1308002713" data-date="13 June 2011 - 03:05 PM"><p>
Take a look at the example. In 2.3.2, you'll have to have a page break interval set or force the onPageBreak event to be called somehow as it doesn't get called on physical page breaks in PDF. In 2.6.2, this is not the case. Hope this helps. Let me know if you have questions. Be sure to run this in PDF, there is another bug that causes the border lines on the rows not to show up in the preview or web viewer.<br /></p></blockquote>
mwilliams
I don't see the same. I set the page break interval to 37. In my PDF report, I get 37 rows per page and the count resets after each page and starts with 5 rows and then a line again. Not sure why yours isn't showing the same.
vensw
Guru,<br />
<br />
This is what I'm doing in the <span style='color: #FF0000'><strong class='bbc'>BIRT version 2.3.2</strong></span>. Kindly, let me know if I'm missing anything.<br />
<br />
<strong class='bbc'>Item</strong> : <strong class='bbc'>Method</strong> : <strong class='bbc'>Logic</strong><br />
<br />
For "Report" : initialize() : myRowCount=0;<br />
<br />
For "Table" : onPageBreak(): myRowCount=0;<br />
<br />
For Table "Detail Row" : onCreate() : myRowCount++;<br />
onRender() : if(myRowCount%5==0) { <br />
this.getStyle.borderBottomStyle = "Solid";<br />
this.getStyle.borderBottomWidth = "Thin";<br />
this.getStyle.borderBottomColor = "black";<br />
}<br />
<br />
Regards,<br />
EVS.<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78458" data-time="1308065564" data-date="14 June 2011 - 08:32 AM"><p>
I don't see the same. I set the page break interval to 37. In my PDF report, I get 37 rows per page and the count resets after each page and starts with 5 rows and then a line again. Not sure why yours isn't showing the same.<br /></p></blockquote>
mwilliams
That is correct as long as you have a page break interval set on your table. You'll need to make sure the page break happens for it to work in 2.3.2.
vensw
I set my Page Break Interval to 3000. Do you think this number affects the line????<br />
Now comes another question: If you set the Page Break Interval to say 50 in your report, does the pages in the pdf have 50 rows in every page?? <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
<br />
<br />
Regards,<br />
EVS<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78463" data-time="1308068560" data-date="14 June 2011 - 09:22 AM"><p>
That is correct as long as you have a page break interval set on your table. You'll need to make sure the page break happens for it to work in 2.3.2.<br /></p></blockquote>
mwilliams
EVS,
With the way that BIRT 2.3.2 handles page breaks in PDF, I think you'll need to set a page break interval that will fit on a page size. Like in my example, I used 37 as the page break interval because I wanted an non multiple of 5, so you could see it work, but I needed that many to be able to fit on a page, which it does.
vensw
Guru,<br />
<br />
I tried setting the Page Break Interval on the report you have posted earlier. I could see what is going on.<br />
Thank you for your time and patience. You ROCK..
<br />
<br />
P.S: Could you please help me with the other post by the title "Display Master Page Footer only on Last Page" in BIRT 2.3.2?<br />
<br />
Regards,<br />
EVS.<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'vensw'" data-cid="78464" data-time="1308069201" data-date="14 June 2011 - 09:33 AM"><p>
I set my Page Break Interval to 3000. Do you think this number affects the line????<br />
Now comes another question: If you set the Page Break Interval to say 50 in your report, does the pages in the pdf have 50 rows in every page?? <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
<br />
<br />
Regards,<br />
EVS<br /></p></blockquote>
mwilliams
If you run this in the web viewer and export to PDF, you'll see that the label only appears in the last page. This doesn't work if you just select PDF from the run menu because the run and render tasks are not used separately like they are with the web viewer export. Hope this helps.
vensw
Guru,<br />
<br />
If you combine both logics(line Logic, and footer Logic) in to one report and when you try to "View Report in Web Viewer", and then Export into pdf, you are getting the black line after each Row in the pdf. Could you see this?? If you have time, kindly explain me what exactly is going on. I believe this will be interesting to know.
<br />
<br />
Regards,<br />
EVS.<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78469" data-time="1308070724" data-date="14 June 2011 - 09:58 AM"><p>
If you run this in the web viewer and export to PDF, you'll see that the label only appears in the last page. This doesn't work if you just select PDF from the run menu because the run and render tasks are not used separately like they are with the web viewer export. Hope this helps.<br /></p></blockquote>
mwilliams
EVS,
Move the code from the onRender to the onCreate. I moved this when it wasn't working in the preview. It works in the run->PDF, but doesn't work when exporting to PDF. If you move it back to the onCreate where I originally had it, it'll work! Sorry, I forgot to change it back before posting the original example.