Crosstab shows nothing

I try to use crosstab to show data from javabean.
My bean, PerformanceData, has four fields, "month", "week", "category", "subcat", and "data".
I use "month" and "week" as a row group, and use "category" and "subcat" as a column group.

The problem is my crosstab in the report doesn't show anything. I have already set the compatibility to 1.2.0 version.

The following is my code.
<br />
...<br />
<br />
PerformanceData[] dd = new PerformanceData[2];<br />
            for (int i=0; i< dd.length; i++)<br />
            {<br />
                dd<i> = new PerformanceData();<br />
                dd<i>.setData ((float)i);<br />
            }<br />
            dd[0].setMonth ("month0"«»);<br />
            dd[0].setWeek ("week0"«»);<br />
            dd[0].setCategory ("cat0"«»);<br />
            dd[0].setSubcat ("sub0.0"«»);<br />
            <br />
            dd[1].setMonth ("month1"«»);<br />
            dd[1].setWeek ("week1"«»);<br />
            dd[1].setCategory ("cat1"«»);<br />
            dd[1].setSubcat ("sub1.1"«»);<br />
<br />
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(Arrays.asList (dd));<br />
<br />
jasperPrint = JasperFillManager.fillReport (jasperReport, parameters, dataSource);<br />
            <br />
JasperViewer.viewReport (jasperPrint, false);<br />
</td></tr></tbody></table><br />
<br />
My .jrxml is in an attached file<br />
 [file name=test2.jrxml size=21907][/file]<br />
<br />
Thank you,<br />
Thanapolr<br>Post edited by: thanapolr, at: 2006/08/15 11:30
thanapolr's picture
Joined: Aug 14 2006 - 9:02pm
Last seen: 16 years 9 months ago

1 Answer:

Why did you create a subdataset in your report? Your crosstab uses data from the subdataset you specified, but you don't pass any datasource to the subdataset and therefore there will be no data for the crosstab.

This is what you should do:

  • remove the subdataset

  • remove the dataset run from the crosstab dataset

  • move the crosstab in the summary section

  • [/ul]

lucianc's picture
Joined: Jul 17 2006 - 1:10am
Last seen: 1 day 15 hours ago