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)
Consolidating Table Data
Napalm
<p>Hello, I am a BIRT newbie so please bear with me. I am trying to recreate a report previously built in Crystal. The problem I have is a feature that allows it to do "across then down" printing. Essentially, I have a dataset giving me a list of names. I need to make a table that looks something like the following rather than a standard top/down list:</p><p> </p><p>John Doe Jane Doe Bob Doe Gary Doe</p><p>Larry Doe Harry Doe Perry Doe Jerry Doe</p><p> </p><p>Obviously the table can have more than this number of rows depending upon how many names the dataset returns. I am shooting for four columns of the name values though if that helps. In the BIRT field guide I have it recommends concatenating values together, but that doesn't give me the columns I need and it does it for everything. I need something that builds four columns then creates a new row and four more. Thanks in advance.</p>
Find more posts tagged with
Comments
micajblock
<p>Use inline. Do a search on DevShare for 'inline'. You will find a couple of examples.</p>
Napalm
<p>Thanks mblock for your help, I got it working unfortunately it required some direct XML manipulation to apply a CSS style to an element the UI in report builder won't let me do it on. I am concerned as the example mentions it may not work when we export to pdf. I guess we will just have to try it. Here is the example I referenced by the way for future searchers:</p><p> </p><p><a data-ipb='nomediaparse' href='
http://www.birt-exchange.org/devshare/_/designing-birt-reports/705-multiple-columns-within-a-list'>http://www.birt-exchange.org/devshare/_/designing-birt-reports/705-multiple-columns-within-a-list</a></p>
;
kclark
<p>In the past I've built my own HTML tables to do something similar. You'd need to store the data in an ArrayList then build the table in the onCreate() of a text item using some script like this</p><pre class="_prettyXprint">var customername = reportContext.getPersistentGlobalVariable("customername");var phone = reportContext.getPersistentGlobalVariable("phone");var city = reportContext.getPersistentGlobalVariable("city");var state = reportContext.getPersistentGlobalVariable("state");var table = "<table border="1" height="100%" width="100%"><caption><b>Customers</b></caption><tr>";for(i=0;i<customername.size();i++) { if(i%3 == 0) { table += "</tr><tr><td>" + customername.get(i) + "</td>"; }else{ table += "<td>" + customername.get(i) + "</td>"; }}table += "</tr></table>";this.text = table;// Do the same for the rest of your data</pre><p>Take a look at my example, it might not be exactly what you're looking for but I've tested in and it works fine in PDF so it could be a starting place. You could build a table in a text item for each data binding or you could build them all in the same HTML table but then I think you'd need to nest them inside a parent table to make it look good.</p>
Napalm
<p>Hi Kirstopher,</p><p> </p><p>Where exactly in your sample do you buffer the data in an ArrayList? I am not finding it in the rptdesign?</p><p> </p><p>EDIT: Found it, didn't realize you could do scripting on the data source and data set</p>
kclark
<p>I created the ArrayList in the beforeOpen() of the data set. The data is added in onFetch() and then each ArrayList is stored as a PGV in the afterClose() of the data set.</p>