I've got a task, to create JasperReoirts report, which contains dynamic repeating block
Something like this:
"You're cool guy because:
Reason:$F{reason}
Description: $F{desc}
Grade: $F{grade}
"
This block with reason\desc\grade can be repeated several times, depending on java Collection in DTO object. Which instrument should I use? I tried list, but it looks like for single field, not for block.
For example: I've got DTO object for jasper report, which contain List of objects, List. This object in list has 3 String fields (reason, description, grade). So on report I want to see it like repeating block for each element from list
StopListReasons:
Reason: someReason1
Description: someDescription1
Grade: someGrade1
Reason: someReason2
Description: someDescription2
Grade: someGrade2
Reason: someReason3
Description: someDescription3
Grade: someGrade3
I've tried to create table, which row contains 3 labels and 3 textfields, but on preview it's emtpty. Also I was looking for List element, but looks like it doesn't match my case.
Maybe with code from jrxml this problem become more clear
<subDataset name="Dataset1" uuid="c5f7a5d1-6262-4003-a4fb-146ba8515c34">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="adapter.xml"/>
<queryString language="XPath">
<![CDATA[/report/stopListInfos/slInfo]]>
</queryString>
<field name="stopListCode" class="java.lang.String">
<fieldDescription><![CDATA[stopListCode]]></fieldDescription>
</field>
<field name="stopListResult" class="java.lang.String">
<fieldDescription><![CDATA[stopListResult]]></fieldDescription>
</field>
<field name="clientType" class="java.lang.String">
<fieldDescription><![CDATA[clientType]]></fieldDescription>
</field>
</subDataset>
And the table
<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" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Dataset1" uuid="a5a0cf80-5aa6-415c-b31c-044bb856c70c">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/report/StopListInfos/slInfo")]]></dataSourceExpression>
</datasetRun>
<jr:column width="66" uuid="aa9f5289-56ad-47df-93cf-8a81770ecd4c">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:detailCell style="Table_TD" height="110">
<staticText>
<reportElement x="0" y="0" width="66" height="38" uuid="9fa05583-38e1-4cd2-b717-7f953ed29042"/>
<text><![CDATA[1]]></text>
</staticText>
<staticText>
<reportElement x="0" y="38" width="66" height="36" uuid="915e8324-e9b9-452d-983c-3e241f34eb46"/>
<text><![CDATA[2]]></text>
</staticText>
<staticText>
<reportElement x="0" y="74" width="66" height="36" uuid="fc7a9e65-2573-405d-bd3f-c519bd93d162"/>
<text><![CDATA[3]]></text>
</staticText>
</jr:detailCell>
</jr:column>
<jr:column width="134" uuid="82a313a6-2d55-418e-af19-a3ff9439bd6a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:detailCell style="Table_TD" height="110">
<textField>
<reportElement x="0" y="0" width="134" height="38" uuid="003483c6-9aa4-43fe-8d8c-2a5aef9ccc3f"/>
<textFieldExpression><![CDATA[$F{stopListCode}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="38" width="134" height="36" uuid="f3f7f9f6-7482-41a7-a473-0fa5d1a4bbed"/>
<textFieldExpression><![CDATA[$F{stopListResult}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="74" width="134" height="36" uuid="8ca9059f-7c71-44ff-96fd-7b490d4f7c0e"/>
<textFieldExpression><![CDATA[$F{clientType}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>