Home
Analytics
Excel export: can crosstabs automatically become pivot tables?
m00hk00h
<p>Hi everyone,</p><p> </p><p>I am looking for a more 'managable' solution to automatically create pivot tables when reports with crosstabs are exported.</p><p>What I am doing at the moment is this:
On page 1 of the report there is the crosstab, nicely formatted and human readable.
On page 2 there is just a plain table with the data that the crosstab on page is buid on. It is formatted in ISO formats so Excel knows how to handle the values. If this page is exported it's "just" a matter of a bit of selecting, clicking and draggin aroung to create the pivot table. 30 seconds max.</p><p> </p><p>But none the less I would like to spare myself the hassle of integrating said table and having to click around in Excel, I want the crosstab to be a pivot table automatically.
I was looking into maybe using a different emitter which might be able to do that, but that doesn't seem to solve my problem as I found no emitter being able to do that (at least no free one).
Are there other ways that are worth checking out?
Thanks in advance!</p>
Find more posts tagged with
Comments
Yaytay
<p>To my knowledge the only emitters that try to convert crosstabs into pivot tables are the commercial Actuate and Arctorus emitters.</p><p>Most (all?) of the free emitters use the Apache POI library to write the Excel files, and that does not support pivot tables.</p><p> </p><p>However, the SpudSoft emitter does have an option that will save you your 30 seconds of copying and pasting.</p><p>You can prepare an Excel workbook with the pivot table in it all set up and referencing a different sheet that is set up for your data but that has no data in it.</p><p>You can then use this workbook as a template file, which means the emitter reads the file, inserts any data it needs into sheets that it references, leaves other sheets alone, and then saves the result as a new workbook.</p><p> </p><p>This approach enables you to have pivot tables (and Excel charts) based on your BIRT data without actually requiring the emitter to build those structures.</p><p> </p><p>As far as I know the SpudSoft emitter is the only free one that can do this, but it's not particularly difficult to do (the biggest complexity is that before adding this functionality I'd set the sheet names after filling them, but for this to work I have to know the target sheet names up front - this only makes my code harder, it doesn't require anything from the reports).</p><p> </p><p>The functionality was added as <a data-ipb='nomediaparse' href='
https://bitbucket.org/yaytay/spudsoft-birt-excel-emitters/issue/76/permit-the-modification-of-an-existing'>Issue
76</a> of the emitters, and you can see an example of it in use by looking at the <a data-ipb='nomediaparse' href='
https://bitbucket.org/yaytay/spudsoft-birt-excel-emitters/src/ebabcebe9bf132c90eee0f3b1781dc618eb80e6d/SpudSoft BIRT Excel Emitters Tests/src/uk/co/spudsoft/birt/emitters/excel/tests/Issue76ExistingWorkbook.java'>unit
test</a>, <a data-ipb='nomediaparse' href='
https://bitbucket.org/yaytay/spudsoft-birt-excel-emitters/src/ebabcebe9bf132c90eee0f3b1781dc618eb80e6d/SpudSoft BIRT Excel Emitters Tests/src/uk/co/spudsoft/birt/emitters/excel/tests/Issue76ExistingWorkbook.rptdesign'>report
</a>and <a data-ipb='nomediaparse' href='
https://bitbucket.org/yaytay/spudsoft-birt-excel-emitters/src/ebabcebe9bf132c90eee0f3b1781dc618eb80e6d/SpudSoft BIRT Excel Emitters Tests/src/uk/co/spudsoft/birt/emitters/excel/tests/MannedSpaceMissions.xlsx?at=default'>template
file</a> for that issue.</p><p> </p><p>In some ways this is actually better than the Actuate and Arctorus approach because it puts you in complete control of what comes out, but where it falls down is that the setup of the Pivot table has to be done in Excel in advance, so it can't reflect an actual crosstab in a report.</p><p> </p><p>Jim</p>
m00hk00h
<p>Thanks a lot for your input.
Sounds like a nifty little workaround, I`ll look into it and report back.</p>