Home
Analytics
Cross Tab report and Java Integration
rutuja
Hi,
I was looking for an example of creating a simple cross tab report and then integrating it with java. Basically i have a crosstab report with columns being dynamic.
Do i need to use Design Engine API for this?
And is there a sample dataset i can use for this? Can i use a collection of beans?
Is there a sample or example?
Thanks, Rutuja
Find more posts tagged with
Comments
Virgil Dodson
Hi Rutuja,<br />
<br />
You can create BIRT crosstab reports where the columns are dynamic without using scripting. There is a crosstab control that will expand into as many rows and columns as necessary. There is a tutorial available at <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/216-building-a-dynamic-crosstab-birt-2-2-1-tutorial-series/#description'>Building
a Dynamic Crosstab – BIRT 2.2.1 Tutorial Series - Tutorials - BIRT Exchange</a> that may help.<br />
<br />
You can create the entire report using scripting if you need it really dynamic. One example is located here <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/117-dynamic-content-creation-in-birt/#description'>Dynamic
Content Creation in BIRT - Designs & Code - BIRT Exchange</a> and another here <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/156-create-report-dynamically/#description'>Create
report dynamically - Designs & Code - BIRT Exchange</a> and another here <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/262-birt-dynamic-adding-tables-and-columns/#description'>BIRT
: Dynamic Adding Tables and Columns - Designs & Code - BIRT Exchange</a><br />
<br />
There is an example database included with BIRT but you can get data from databases, xml, web services, txt, and using the scripted data source, almost anything available in Java can be used for data.<br />
<br />
There are lots of options to deploy your report designs after you create them. You could use the BIRT Report Engine and write some Java classes to generate your reports. <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/deploying-birt-reports/568-execute-birt-reports-from-java-class/#description'>Execute
BIRT Reports from Java class - Designs & Code - BIRT Exchange</a><br />
<br />
Or it is simplier to call the servlets that get deployed with the WebViewerExample available with the BIRT Runtime. You can see some options here: <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/deploying-birt-reports/492-birt-viewer-2-3-user-reference/#description'>Birt
Viewer 2.3 User Reference - Other Resources - BIRT Exchange</a>
rutuja
Thanks Virgil for your response.
I went through the links , they are definitely fehpful. But i am still not finding a way to populate a crosstab using script which in turn pulls the data from a java class.
Basically I need to create a crosstab report which i wish to populate using a scripted datasource . In the script i am refering a POJO for populating the report.
I am using something like:
dimension["Name"]["Name"] = allIndicesrow.getName();
With a report having a simple table i used something like
row["Company"] = allIndicesrow.getCompany(); It worked fine. But i am not sure how to reference the dimensions, members and measures and populate them.
Besides i have three sets of measure, i display either one, two or all three depending on some criteria...that's the dynamic part. I am not sure how to handle that either.
Is there any example with sample java code snippet and Script snippet for implementing this type of report.
The Script-POJO example i am finding is for a simple report.
Do i just extend that? And handle the crosstab part using logic having say an arraylist within arraylist?
Or is there some direct way?
Thanks again for your response,
Rutuja
rutuja
Hi,
I mimicked what they did for the POJO simple table sample and it also worked for crosstab.
It seems to be working now.
Thanks, Rutuja