Jump to content
Changes to the Jaspersoft community edition download ×

Nested tables


laereba

Recommended Posts

I'm using Nested Java Collections to generate a report.

I've managed to display a nested collection of my main objects as a table.

Now I would like to display another level as a table within a table, but the engine throws an exception on this.

The main java object contains a List-attribute named "interestingCases".

And an InterestingCase object contains & List-attribute named "interestingCaseReasons".

Can anyone tell me, if it possible to nest these tables and if so, what I'm doing wrong.

Thanks in advance,

Bart

Code:
<band height="72">            <componentElement>                <reportElement key="table 8" style="table 8" x="0" y="32" width="555" height="20"/>                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">                    <datasetRun subDataset="InterestingCaseDataSet">                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{interestingCases})]]></dataSourceExpression>                    </datasetRun>                    <jr:column width="90">                        <jr:columnHeader style="table 8_CH" height="30" rowSpan="1">                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">                                <reportElement x="0" y="0" width="90" height="30"/>                                <textElement/>                                <textFieldExpression class="java.lang.String"><![CDATA[$R{report.enquiry.table.interesting.case.header.reason}]]></textFieldExpression>                            </textField>                        </jr:columnHeader>                        <jr:detailCell style="table 8_TD" height="20" rowSpan="1">                            <componentElement>                                <reportElement key="table 11" style="table 11" x="0" y="0" width="90" height="20"/>                                <jr:table>                                    <datasetRun subDataset="InterestingCaseReasonDataSet">                                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{interestingCaseReasons})]]></dataSourceExpression>                                    </datasetRun>                                    <jr:column width="90">                                        <jr:detailCell style="table 11_TD" height="20">                                            <textField>                                                <reportElement x="0" y="0" width="90" height="20"/>                                                <textElement/>                                                <textFieldExpression class="java.lang.String"><![CDATA[str($F{messageKey})]]></textFieldExpression>                                            </textField>                                        </jr:detailCell>                                    </jr:column>                                </jr:table>                            </componentElement>                        </jr:detailCell>                    </jr:column>                </jr:table>            </componentElement>        </band>
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...