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)
Using for-loops
birt_ag
Hi,
I'm very new to BIRT. Wanted to know how we can run for-loops on a dataset so that page repetition wont be affected. The problem is i've a report layout like one table below other and both contains for-loops. I'm using xml as datasource and BIRT 4.2.0 is the version.
Find more posts tagged with
Comments
kclark
birt_ag here's a link to a devshare showing how to use scripted datasets, depending on what you're trying to do this might be a good resource for you to take a look at. It looks like the example reports didn't attach, can you repost them?
birt_ag
Hi clark,
I couldnt find any links in your reply, can u repost it.. I'm using xml as datasource, but u said about scripted datasource, will it help ?
sorry i missed to attach the report designed, I'm attaching the sample report, taking some simple scenario as example so that it wont be difficult in undestanding.
If you see the report, there are 2 tables inside one table, the 2 inner tables are named marks_table and attendance_table. Now if you try to run the report, only the scores table content are printed properly.
Rather i would like to fix the height of 2 tables say to 3cms and print as many contents as possible within that and repeat the remaining in next page with same table structure, i.e both inner tables should be repeated in next page even though there might be no data in any one of them.
I'm ready to make modifications to xml.
Thank You..
kclark
birt_ag,<br />
You want to make a pagebreak based on the height of the parent table, is that correct? <a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1276-page-break-on-height/'>This
devshare</a> show's how to do that. I'll continue to work on an example for you if that's what you are trying to do with the report.
kclark
I've attached an example for you to take a look at. It uses the same xml that you gave me so you'll want to point the data source to it on your machine. I know you were asking about page breaks after a specific height but this might work better for you. It breaks after x rows, in this case 6. 3 in table one and 3 in table two. I created a computed column in attendance and and marks to count the total rows. Then I created a scripted data set.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
currentRow = 1;
temp = reportContext.getPersistentGlobalVariable("totalCount");
if(temp > 12){
totalRows = temp;
} else {
totalRows = 12;
}
</pre>
<br />
This checks if the total rows is greater than 12 (number of months in attendance) and if it is then we'll use it as the total number of rows, otherwise we'll use 12 by default. Let me know if this helps!
birt_ag
hi clark, thanks for the reply.. will check this and let you know..
Thank you..
birt_ag
hi clark, actually i wanted the table height to be fixed. I'll check the devshare link you had posted and let you know..
Thank you
birt_ag
Hi Clark,
The solution u gave fits my needs, but is it possible to fix the height of tables. I've requirement like that, because it looks bit odd if the size of the table varies in each page.
I'm quite happy with the page-break solution you gave in previous reply, just i wanted to fix the height of table for the same solution you gave.
For instance, if the height of page is 10 cms, i want to divide amongst the two inner table with 3 cms for each and remaining with the header contents. Is it possible ?
Thank you..
birt_ag
Hi,
I tried to modify the report you gave by adding the height to table, but when i previewed it in webviewer the height is displayed properly with the value i had set, but in doc view its not. Is it a bug with BIRT tool. I'm using BIRT 4.2.0.
Attaching the report for your convenience
Thank you...
kclark
When I run your report everything seems to be generated correctly when going to PDF and Doc. When I print each format they are the same. Can you attach a screenshot showing this?
birt_ag
Hi clark
i've attached the doc and pdf report generated using BIRT 4.2.0 version. If you scroll down to 3rd page the height of the 1st table gets decreased as the no of records inside it is less.
Thank You.
kclark
I've attached another report for you to look at. I added two more footer rows to the first table. Then added aggregation to each to see how many rows are being displayed and makes the correct number of footer rows visible which will keep the table height in PDF. To see the aggregation select each footer row and you should see <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>row["Aggregation"] > 0</pre>
<br />
In the expression builder of visibility.
birt_ag
Hi clark,
Thanks for the solution..
its working in the way required.
Thank you.
birt_ag
but i've one doubt, you have created the scripted data-set by hardcoding the school-ds values, i wanted it be read from xml, coz there will be multiple school details
Thank you.
birt_ag
hi clark,
i tried to design report by looking into the solution you provided. But couldnt get the same result. Is there anything i missed to do in this, can you please help me out ? I'm attaching the design file.
Thank you..