Creating grouped bar or Line graph - charts

I'm working with Jaspersoft Studio 5.6, trying to create a report that shows multiple XY (or bar) charts based upon a grouping parameter. I've dumbed down my original data to the following, and I still can't figure it out.
DATA
+------+------+-------+
| xrow | yrow | group |
+------+------+-------+
| 1 | 11 | 1 |
| 2 | 12 | 1 |
| 3 | 10 | 1 |
| 1 | 5 | 2 |
| 2 | 10 | 2 |
| 3 | 14 | 2 |
+------+------+-------+
Here is my XML code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="group3" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="cdd6d2cf-7c0c-4d79-8cfe-a4f1e04da233">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Office"/>
<queryString language="SQL">
<![CDATA[SELECT maintenance.test.xrow,
maintenance.test.yrow,
maintenance.test.group
FROM maintenance.test]]>
</queryString>
<field name="xrow" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="yrow" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="group" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<sortField name="group"/>
<sortField name="xrow"/>
<group name="Group1">
<groupExpression><![CDATA[$F{group}]]></groupExpression>
<groupHeader>
<band height="190">
<barChart>
<chart evaluationTime="Report">
<reportElement x="40" y="0" width="460" height="190" uuid="582be7ed-4b48-4d55-a2b6-1295290d34e3"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Group" resetGroup="Group1"/>
<categorySeries>
<seriesExpression><![CDATA["SERIES 1"]]></seriesExpression>
<categoryExpression><![CDATA[$F{xrow}]]></categoryExpression>
<valueExpression><![CDATA[$F{yrow}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
<itemLabel/>
<categoryAxisFormat>
<axisFormat/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</groupHeader>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
</jasperReport>
I've created a report group for the column "group"
I'm putting the chart in the Group header band. and I've tried setting "reset on" to GROUP, as well as REPORT (in chart wizard) with no change in results. See below screen shot.
I'm at a loss of what to try next.

I took a closer look at the chart properties, and noticed there was a parameter called Evaluation Time, Changed it from "Report" to the name of the group. Alternatively change the following..
<chart evaluationTime="Report">
to
<chart evaluationTime="Group" evaluationGroup="group">
With the chart in the group header\footer, this will allow the chart to only show the current group data.

Related

Suppressing duplicate values in groups

I have a report with 2 bands:
A detail band used to display rows that have Group=N i.e. if Group <> N, it is hidden
A group footer, used to display an aggregate of rows that have Group=Y i.e. if Group <> Y, it is hidden
Both bands display a Date, Name, and Amount. The group footer aggregates the Amount field.
I would like to suppress repeating Dates.
E.g, given the following data:
+------------+------+-------+--------+
| Date | Name | Group | Amount |
+------------+------+-------+--------+
| 2020-06-01 | A | Y | 5 |
| 2020-06-01 | A | Y | 10 |
| 2020-06-01 | D | N | 2 |
| 2020-06-01 | Z | Y | 4 |
| 2020-06-02 | B | N | 1 |
| 2020-06-02 | G | Y | 6 |
| 2020-06-02 | G | Y | 3 |
+------------+------+-------+--------+
It should display:
+------------+------+--------+
| Date | Name | Amount |
+------------+------+--------+
| 2020-06-01 | A | 15 |
| | D | 2 |
| | Z | 4 |
| 2020-06-02 | B | 1 |
| | G | 9 |
+------------+------+--------+
With isPrintRepeatedValues="false", it duplicates dates as they are in different bands:
+------------+------+--------+
| Date | Name | Amount |
+------------+------+--------+
| 2020-06-01 | A | 15 |
| 2020-06-01 | D | 2 |
| | Z | 4 |
| 2020-06-02 | B | 1 |
| 2020-06-02 | G | 9 |
+------------+------+--------+
Adding a:
<group name="DateGroup">
<groupExpression><![CDATA[$F{Date}]]></groupExpression>
</group>
and suppressing the Date fields with the expressions:
<printWhenExpression><![CDATA[$V{DateGroup_COUNT} == 1]]</printWhenExpression>
doesn't work either, as the following display shows. I've included the Group and DateGroup_Count values for debugging:
+------------+------+--------+-------+-----------------+
| Date | Name | Amount | Group | DateGroup_COUNT |
+------------+------+--------+-------+-----------------+
| | A | 15 | Y | 2 |
| | D | 2 | N | 3 |
| | Z | 4 | Y | 4 |
| 2020-06-02 | B | 1 | N | 1 |
| | G | 9 | Y | 3 |
+------------+------+--------+-------+-----------------+
2020-06-01 should be displayed in the first row, but in the above the DateGroup_COUNT value represents the last row in the aggregated band, so the Date field is suppressed when it shouldn't be.
Note that the above can possibly be achieved in a single band. It represents a simplified version of a report that cannot be achieved using a single band as it:
calculates the Amount column differently in each band
has different fields in each band which would need to be selectively shown/hidden. These would also overlap
The CSV used for the data source:
Date,Name,Group,Amount
2020-06-01,A,Y,5
2020-06-01,A,Y,10
2020-06-01,D,N,2
2020-06-01,Z,Y,4
2020-06-02,B,N,1
2020-06-02,G,Y,6
2020-06-02,G,Y,3
The JRXML
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="duplicatetest" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="datasuppressiontestdata"/>
<field name="Date" class="java.util.Date"/>
<field name="Name" class="java.lang.String"/>
<field name="Group" class="java.lang.String"/>
<field name="Amount" class="java.math.BigDecimal"/>
<variable name="groupTotal" class="java.math.BigDecimal" resetType="Group" resetGroup="Aggregate" calculation="Sum">
<variableExpression><![CDATA[$F{Amount}]]></variableExpression>
</variable>
<group name="DateGroup">
<groupExpression><![CDATA[$F{Date}]]></groupExpression>
</group>
<group name="Aggregate">
<groupExpression><![CDATA[$F{Group}]]></groupExpression>
<groupFooter>
<band height="30">
<printWhenExpression><![CDATA[EQUALS($F{Group}, "Y")]]></printWhenExpression>
<textField evaluationTime="Group" evaluationGroup="DateGroup" pattern="yyyy-MM-dd">
<reportElement isPrintRepeatedValues="false" x="0" y="0" width="130" height="30" printWhenGroupChanges="DateGroup">
<printWhenExpression><![CDATA[$V{DateGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textElement>
<paragraph lineSpacing="Fixed"/>
</textElement>
<textFieldExpression><![CDATA[$F{Date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="134" y="0" width="116" height="30"/>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="260" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{groupTotal}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="458" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{DateGroup_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="389" y="0" width="68" height="30"/>
<textFieldExpression><![CDATA[$F{Group}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<columnHeader>
<band height="30" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="130" height="30"/>
<text><![CDATA[Date]]></text>
</staticText>
<staticText>
<reportElement x="134" y="0" width="116" height="30"/>
<text><![CDATA[Name]]></text>
</staticText>
<staticText>
<reportElement x="260" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Amount]]></text>
</staticText>
<staticText>
<reportElement x="458" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<text><![CDATA[DateGroup_COUNT]]></text>
</staticText>
<staticText>
<reportElement x="390" y="0" width="68" height="30"/>
<text><![CDATA[Group]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="40" splitType="Stretch">
<printWhenExpression><![CDATA[!EQUALS($F{Group}, "Y")]]></printWhenExpression>
<textField evaluationTime="Group" evaluationGroup="DateGroup" pattern="yyyy-MM-dd">
<reportElement isPrintRepeatedValues="false" x="0" y="0" width="130" height="30" printWhenGroupChanges="DateGroup">
<printWhenExpression><![CDATA[$V{DateGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[$F{Date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="134" y="0" width="116" height="30"/>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="260" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{Amount}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="458" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{DateGroup_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="389" y="0" width="68" height="30"/>
<textFieldExpression><![CDATA[$F{Group}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
I created new variable to read DateGroup count . On change of each date reset to 1.
And printed Date only when Dategroup is 1.
Check below jrxml. It gives your desired output.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="duplicatetest" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="04479c0d-d012-45d8-a8d1-f281276aba62">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="datasuppressiontestdata"/>
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="Date" class="java.util.Date"/>
<field name="Name" class="java.lang.String"/>
<field name="Group" class="java.lang.String"/>
<field name="Amount" class="java.math.BigDecimal"/>
<variable name="groupTotal" class="java.math.BigDecimal" resetType="Group" resetGroup="Aggregate" calculation="Sum">
<variableExpression><![CDATA[$F{Amount}]]></variableExpression>
</variable>
<variable name="COUNT_GROUP_1" class="java.lang.Integer" resetType="Group" resetGroup="DateGroup" incrementType="Group" incrementGroup="DateGroup">
<variableExpression><![CDATA[( $V{Aggregate_COUNT} == 1) ? $V{COUNT_GROUP_1} + 1 : $V{COUNT_GROUP_1}]]></variableExpression>
<initialValueExpression><![CDATA[0]]></initialValueExpression>
</variable>
<group name="DateGroup">
<groupExpression><![CDATA[$F{Date}]]></groupExpression>
</group>
<group name="Aggregate">
<groupExpression><![CDATA[$F{Group}]]></groupExpression>
<groupFooter>
<band height="30">
<printWhenExpression><![CDATA[EQUALS($F{Group}, "Y")]]></printWhenExpression>
<textField pattern="yyyy-MM-dd">
<reportElement isPrintRepeatedValues="false" x="0" y="0" width="130" height="30" printWhenGroupChanges="DateGroup" uuid="16819840-1496-42ac-aec8-02e50a104608">
<printWhenExpression><![CDATA[$V{COUNT_GROUP_1}==1]]></printWhenExpression>
</reportElement>
<textElement>
<paragraph lineSpacing="Fixed"/>
</textElement>
<textFieldExpression><![CDATA[$F{Date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="134" y="0" width="116" height="30" uuid="5008a25a-6654-4ffc-95dd-cdefac6b1c3a"/>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="260" y="0" width="100" height="30" uuid="c89330be-7a7b-4721-b881-10e5df8ced68"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{groupTotal}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="458" y="0" width="100" height="30" uuid="5dd2909c-4ffb-4296-9a42-3656bed378fe"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{DateGroup_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="389" y="0" width="68" height="30" uuid="61b8eb92-90ec-4727-a69c-642f063f08fe"/>
<textFieldExpression><![CDATA[$F{Group}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<columnHeader>
<band height="30" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="130" height="30" uuid="f05195da-f90c-4026-9e38-89a902853871"/>
<text><![CDATA[Date]]></text>
</staticText>
<staticText>
<reportElement x="134" y="0" width="116" height="30" uuid="2d40f4cc-a795-4e67-9fac-7a6e77085de3"/>
<text><![CDATA[Name]]></text>
</staticText>
<staticText>
<reportElement x="260" y="0" width="100" height="30" uuid="e5c44c50-93da-45a0-8a21-18fab3295972"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Amount]]></text>
</staticText>
<staticText>
<reportElement x="458" y="0" width="100" height="30" uuid="1b22596b-22e0-4b22-b2ab-9ed699ddd61f"/>
<textElement textAlignment="Right"/>
<text><![CDATA[DateGroup_COUNT]]></text>
</staticText>
<staticText>
<reportElement x="390" y="0" width="68" height="30" uuid="8210e103-4473-4a5e-a915-a568356f76ac"/>
<text><![CDATA[Group]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="40" splitType="Stretch">
<printWhenExpression><![CDATA[!EQUALS($F{Group}, "Y")]]></printWhenExpression>
<textField pattern="yyyy-MM-dd">
<reportElement isPrintRepeatedValues="false" x="0" y="0" width="130" height="30" printWhenGroupChanges="DateGroup" uuid="9112a549-c2e1-4b49-996e-d12f5f1307cf">
<printWhenExpression><![CDATA[$V{COUNT_GROUP_1}==1]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[$F{Date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="134" y="0" width="116" height="30" uuid="111ee635-3426-4a2b-8f68-3e4e6dc003c3"/>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="260" y="0" width="100" height="30" uuid="c0eac89a-54ac-4480-9fa1-3c841aed7d89"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{Amount}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="458" y="0" width="100" height="30" uuid="b2ff7aaf-ab81-4b3d-a45f-9094044af7bf"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{DateGroup_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="389" y="0" width="68" height="30" uuid="5ac47f28-41e3-4940-bcdb-91b2ba85f30b"/>
<textFieldExpression><![CDATA[$F{Group}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
If I understand the task right, all you need is to create two groups and show total for 2nd group.
You can solve this task in 5 steps:
Sort data by Date and Name fields.
Create group by Date field
Create group by Name field
Create variable to show sum of all Amount values at each group by Name
Create simple report using Detail and Column Header bands only.
The report's template
The template is using data adapter based on your csv file.
The jrxml code:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="duplicatetest" pageWidth="390" pageHeight="842" columnWidth="350" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="datasuppressiontestdata"/>
<field name="Date" class="java.util.Date"/>
<field name="Name" class="java.lang.String"/>
<field name="Group" class="java.lang.String"/>
<field name="Amount" class="java.math.BigDecimal"/>
<sortField name="Date"/>
<sortField name="Name"/>
<variable name="groupTotal" class="java.math.BigDecimal" resetType="Group" resetGroup="nameGroup" calculation="Sum">
<variableExpression><![CDATA[$F{Amount}]]></variableExpression>
</variable>
<group name="dateGroup">
<groupExpression><![CDATA[$F{Date}]]></groupExpression>
</group>
<group name="nameGroup">
<groupExpression><![CDATA[$F{Name}]]></groupExpression>
</group>
<columnHeader>
<band height="30" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="130" height="30"/>
<text><![CDATA[Date]]></text>
</staticText>
<staticText>
<reportElement x="130" y="0" width="120" height="30"/>
<text><![CDATA[Name]]></text>
</staticText>
<staticText>
<reportElement x="250" y="0" width="100" height="30"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Amount]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="30" splitType="Stretch">
<textField pattern="yyyy-MM-dd">
<reportElement x="0" y="0" width="130" height="30">
<printWhenExpression><![CDATA[$V{dateGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[$F{Date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="130" y="0" width="120" height="30">
<printWhenExpression><![CDATA[$V{nameGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto">
<reportElement x="250" y="0" width="100" height="30">
<printWhenExpression><![CDATA[$V{nameGroup_COUNT} == 1]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA[$V{groupTotal}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
I used printWhenExpression property for showing data of only first record for each Date and Name groups. I removed all "duplicates" with help of this trick.
With help of isRemoveLineWhenBlank="true" property I hid all blank lines (for cases $V{nameGroup_COUNT} > 1).
The last trick is to set evaluationTime="Auto" property for textField with total sum.
Output result
The generated report looks like this at JSS:

"justified" property of textField and staticText is not working in jaspersoft report

I want add set text in textField and staticText as it will divide in equal space in jasper report.
Text should be distributed like below image.
Setting textAlignment to "Justified", but it didn't work.
Can someone suggest me the solution for this?
I have to do it in jasper report and generate an report in PDF file.
<staticText>
<reportElement x="52" y="34" width="135" height="20" uuid="44eed122-c07e-42d0-b696-a6ad54b759a4"/>
<textElement textAlignment="Justified" verticalAlignment="Middle" rotation="None">
<font fontName="Serif" size="12"/>
</textElement>
<text><![CDATA[Welcome]]></text>
</staticText>
Text should be distributed like bellow text in PDF report.
Justification - the spaces between words and between glyphs or letters are stretched or compressed in order to align both the left and right ends of consecutive lines of text. When using justification, it is customary to treat the last line of a paragraph separately by simply left or right aligning it, depending on the language direction.
So you need lines of text to see the difference between textAlignment="Left" and textAlignment="Justified" values. I guess the alignment textAlignment="Justified" works properly but it treats the text as "the last line of a paragraph". If you put long text in staticText you will have no troubles (v6.9.0.). See the image below.
The workaround could be something just like this:
Create tabSet variable
<variable name="tabSet" class="java.lang.String">
<variableExpression><![CDATA[" "]]></variableExpression>
<initialValueExpression><![CDATA[" "]]></initialValueExpression></variableExpression>
</variable>
Add the variable to any expression you need to be justified including the last\first line
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet"+$V{tabSet}]]></textFieldExpression>
Set alignment and markup
<textElement textAlignment="Justified" markup="html"/>
The full example below:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report3" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="00216f45-7b94-4847-94ea-7ea4f1508a6e">
<scriptlet name="DynTable" class="net.sf.jasperreports.engine.JRDefaultScriptlet">
<scriptletDescription><![CDATA[]]></scriptletDescription>
</scriptlet>
<variable name="tabSet" class="java.lang.String">
<variableExpression><![CDATA[" "]]></variableExpression>
<initialValueExpression><![CDATA[" "]]></initialValueExpression>
</variable>
<detail>
<band height="560" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="550" height="20" uuid="803f5f42-1d88-4da6-973e-bb70e6e99388"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Justified"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="0" y="20" width="550" height="20" uuid="803f5f42-1d88-4da6-973e-bb70e6e99388"/>
<textElement textAlignment="Justified" verticalAlignment="Middle" markup="styled"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="40" width="550" height="20" uuid="1132e9a7-8b30-4167-94ce-a013480dca9d"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Left"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="60" width="550" height="20" uuid="803f5f42-1d88-4da6-973e-bb70e6e99388"/>
<textElement textAlignment="Left" verticalAlignment="Justified"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="80" width="550" height="20" uuid="bc341f2a-916e-4391-90dc-8b68684d2c6c"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Justified"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="0" y="100" width="550" height="60" uuid="803f5f42-1d88-4da6-973e-bb70e6e99388"/>
<textElement textAlignment="Justified" verticalAlignment="Justified" markup="none"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="160" width="550" height="20" uuid="8472fd7d-b77c-46bf-9a11-b5f4cd1fff78"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Left"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="180" width="550" height="60" uuid="803f5f42-1d88-4da6-973e-bb70e6e99388"/>
<textElement textAlignment="Left" verticalAlignment="Top"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="240" width="550" height="20" uuid="8da01066-6dc6-4551-8530-2ac179fab340"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Workaround"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="260" width="550" height="20" uuid="931c0377-e69d-41e9-8c0e-eec6b53d14d1"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Justified" markup="html"/>
<textFieldExpression><![CDATA["Lorem"+$V{tabSet}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="280" width="550" height="20" uuid="aa466b7b-c67b-4cf7-bb52-09d52fceedf6"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Justified" markup="html"/>
<textFieldExpression><![CDATA["Lorem ipsum"+$V{tabSet}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="300" width="550" height="20" uuid="e6cb9bd0-80b6-4138-9e58-803caf5b9c54"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Justified" markup="html"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor"+$V{tabSet}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="1" y="320" width="550" height="20" uuid="113a944e-b09b-419e-abf9-06b76959731d"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Justified" markup="html"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit"+$V{tabSet}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="340" width="550" height="20" uuid="920883bb-cd3a-4a26-99e4-ad0a5415033f"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Justified" markup="html"/>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet"+$V{tabSet}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

Jasper Reports: Subreport in detail band prints only on first record

I have a subreport in my main report. This is in the detail band.
The problem is it only runs for the first record of the main report. I wish it run for all records of detail band. It is not showing on another pages.
To run it, I transfer 1 sql query parameter that feeds the detail band.
In the pages of the first record, it appears, as shown in the image below:
In the pages of the subsequent records, it does not showing or does not return data (I can not say).
As the image below:
This is the main report jrxml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2016-09-26T11:09:48 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="1350" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="511" leftMargin="42" rightMargin="42" topMargin="71" bottomMargin="71" uuid="55ddfd1b-0389-4716-a115-0b6966f4bd05">
<property name="net.sf.jasperreports.export.xml.start.page.index" value="1"/>
<property name="net.sf.jasperreports.export.xml.end.page.index" value="2"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="cm"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="cm"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="cm"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="cm"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="SQLSRV_SQLDEV"/>
<parameter name="CodCand" class="java.lang.Integer" isForPrompting="false">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<parameter name="PAGE_INDEX" class="java.lang.Integer" isForPrompting="false">
<defaultValueExpression><![CDATA1]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[ /* QUERY */ ]]>
</queryString>
<field name="Cod_cand" class="java.lang.Integer"/>
<field name="EstadoReg_cand" class="java.lang.Integer"/>
<field name="Nome_cand" class="java.lang.String"/>
<field name="Sigla_idiomaNav" class="java.lang.String"/>
<pageHeader>
<band height="70" splitType="Stretch">
<image>
<reportElement x="0" y="0" width="110" height="50" uuid="db7d5ce0-2740-4b4a-b84e-d4aacac33ced"/>
<imageExpression><![CDATA["/home/diego.queres/Desenv/Relatórios Clientes/MyReports/Cafe com leite.JPG"]]></imageExpression>
</image>
</band>
</pageHeader>
<detail>
<band height="563" splitType="Stretch">
<textField>
<reportElement x="0" y="10" width="260" height="30" uuid="ff0bc8d6-87d0-4fba-84fe-b3def51ac8f1"/>
<textElement>
<font fontName="Arial" size="18"/>
</textElement>
<textFieldExpression><![CDATA[$F{Nome_cand}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="Float" x="100" y="60" width="160" height="30" uuid="dd77bdb7-560b-4054-88ea-2b14f5032b06"/>
<textFieldExpression><![CDATA[$F{Sigla_idiomaNav}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="0" y="60" width="100" height="30" uuid="2a0e78b4-1fc0-428d-95fa-86c7f8e669a0"/>
<text><![CDATA[Idioma candidato]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="100" y="90" width="410" height="40" uuid="54e06bcd-be90-48ca-b861-78b39f55681c"/>
<textFieldExpression><![CDATA[$F{EstadoReg_cand} + "\n" +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pretium quam non odio cursus viverra. Integer dolor sapien, suscipit quis placerat eget, tincidunt at ipsum. Morbi molestie sit amet tellus non commodo. Donec vel arcu lobortis, bibendum metus vitae, varius leo. Maecenas ultrices nisi id sapien volutpat viverra. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed eget erat non felis tempus sodales in id quam. Proin suscipit porta faucibus. Etiam vitae elit facilisis, pulvinar ipsum at, facilisis ante. Nulla ac mauris erat. Curabitur sit amet metus id metus cursus lacinia eget ut orci. Nullam ornare erat nulla, pretium viverra justo hendrerit ac. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent sed nisl risus. Nulla facilisi." +
"\n" +
"Curabitur sodales finibus arcu at condimentum. Integer at tempor mi, eu euismod dolor. Nulla facilisi. Suspendisse potenti. Nullam feugiat turpis condimentum turpis tempor sagittis. Pellentesque accumsan elementum auctor. Mauris orci dui, convallis id sagittis a, dapibus eget dui. Vivamus sit amet ante id elit malesuada porta non eget dui. Nulla nisi sem, dictum at metus eu, facilisis ornare neque. Pellentesque in lectus vel libero laoreet faucibus vel non odio. Aenean euismod neque eu nisl rutrum fringilla. In nibh enim, sollicitudin ut aliquet sit amet, pulvinar sit amet odio. Duis fringilla, odio eget fermentum eleifend, urna sem volutpat diam, at dictum elit turpis ut mauris. Vivamus rutrum turpis ut ex sodales vulputate." +
"\n" +
"Curabitur laoreet ligula et augue tincidunt pharetra. Fusce finibus non tellus in sollicitudin. Aliquam quis venenatis tellus. Quisque leo erat, rutrum nec ex a, dictum interdum augue. In et tincidunt diam. Sed sagittis nibh id ex laoreet hendrerit. Aliquam non nunc odio. Nam dolor diam, eleifend sit amet enim vel, laoreet tincidunt nibh. Etiam vitae elementum mi. Ut ornare a sapien sit amet congue." +
"\n" +
"Maecenas tempor cursus mauris. Mauris vehicula pharetra scelerisque. Maecenas feugiat justo purus, vel fermentum odio venenatis eu. Aliquam quis libero maximus, convallis odio a, eleifend nisi. Phasellus placerat, nulla ut rutrum sagittis, magna turpis tincidunt nisl, vel mollis libero massa ut arcu. Donec et tincidunt sem, ut pellentesque arcu. Sed laoreet ornare gravida. Nunc mauris mauris, elementum sit amet porttitor vel, feugiat ut sem. Donec ultrices quam mollis blandit facilisis. Morbi mollis semper enim, nec lobortis nisl blandit at. Ut leo magna, maximus ullamcorper finibus et, bibendum ut eros." +
"\n" +
"Nam eros risus, lacinia semper augue sed, interdum dapibus turpis. Mauris placerat iaculis fringilla. Vestibulum ullamcorper nibh et tortor ullamcorper accumsan. In ipsum eros, consectetur non blandit non, eleifend id elit. Suspendisse non bibendum mi. Suspendisse finibus eleifend mauris. Integer rutrum, ex vitae suscipit luctus, sapien erat tincidunt dui, sit amet ultricies magna sem at ligula. Fusce dictum, dolor sed commodo rutrum, eros quam eleifend libero, nec aliquam libero risus vitae ipsum. Vivamus nec libero metus. Mauris volutpat sapien vitae tortor tincidunt semper. Integer aliquet purus a urna dictum, id vehicula ante convallis. Suspendisse dolor velit, volutpat ut mi non, faucibus lobortis nulla. Quisque sed nisi nunc."]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="90" width="100" height="40" uuid="2452709f-be5e-4c5a-bece-c54a03e532f7"/>
<text><![CDATA[EstadoReg_cand]]></text>
</staticText>
<break>
<reportElement x="0" y="550" width="509" height="1" uuid="cfd93607-c001-4860-8fe5-848979c466ce"/>
</break>
<subreport>
<reportElement positionType="Float" x="100" y="130" width="409" height="70" uuid="e3dea3c0-56e8-42c8-b35c-d74b42d79858"/>
<subreportParameter name="CodCand">
<subreportParameterExpression><![CDATA[$F{Cod_cand}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["/home/diego.queres/Desenv/Relatórios Clientes/MyReports/1350-formacoes.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<pageFooter>
<band height="66" splitType="Stretch">
<textField>
<reportElement x="409" y="36" width="100" height="30" uuid="422e0e4d-35f2-42eb-bfe1-c805991fd470"/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
Subreport jrxml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2016-09-27T10:20:16 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="1350-formacoes" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a9eac827-ef0f-401c-80eb-8cf6417e4906">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="SQLSRV_SQLDEV"/>
<parameter name="CodCand" class="java.lang.String"/>
<queryString>
<![CDATA[select * from [dbo].[candform] where codcand = $P{CodCand} ]]>
</queryString>
<field name="CodCand_form" class="java.lang.Integer"/>
<field name="Descr_form" class="java.lang.String"/>
<field name="Instit_form" class="java.lang.String"/>
<field name="Pais_form" class="java.lang.String"/>
<field name="Estado_form" class="java.lang.String"/>
<field name="TipoCurso_form" class="java.lang.String"/>
<field name="Descr_cursoGrad" class="java.lang.String"/>
<field name="Descr_cursoPGrad" class="java.lang.String"/>
<field name="Duracao_form" class="java.lang.String"/>
<field name="dataStatus_form2" class="java.lang.String"/>
<field name="dataStatus_form3" class="java.lang.String"/>
<field name="dataStatus_form" class="java.sql.Timestamp"/>
<field name="Situacao_form" class="java.lang.String"/>
<field name="cod_form" class="java.lang.Integer"/>
<field name="cod_formresumido" class="java.lang.Integer"/>
<field name="Nivel" class="java.lang.String"/>
<field name="Area_form" class="java.lang.String"/>
<field name="RowNumber_form" class="java.lang.Integer"/>
<field name="RowNumber_codform" class="java.lang.Integer"/>
<detail>
<band height="70">
<textField>
<reportElement x="120" y="10" width="450" height="30" uuid="41091178-6353-4264-81ff-07919aaeb4dd"/>
<textFieldExpression><![CDATA[$F{Descr_form}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="20" y="10" width="100" height="30" uuid="73c9de13-3e0b-4c65-a9b3-628f419c8efc"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Descr_form]]></text>
</staticText>
<textField>
<reportElement x="120" y="40" width="450" height="30" uuid="ec4daab6-894e-4d8c-9823-a33d5acafa38"/>
<textFieldExpression><![CDATA[$F{Instit_form}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="20" y="40" width="100" height="30" uuid="5408a543-a168-437d-89ef-1ab6671a1b38"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Instit_form]]></text>
</staticText>
</band>
</detail>
</jasperReport>
There are a couple of issues with your report:
There is too much space left between the end of the subreport and the end of the detail band. JasperReports will try to preserve that whitespace and it may cause unnecessary band/page overflow and even run in an infinite loop in some cases.
Your subreport may produce no results when the query returns nothing(the detail band is repeated as many times as the number of records you have in the mainDataset - the one produced by the queryString). This is probably the reason you see nothing after that textField. To test this, either manually check your SQL query or, in the subreport, set:
When No Data Type: No Data Section
and add a noData band (from the Outline view in Jaspersoft Studio) with a staticText of your choice. This will trigger the rendering of only the noData band when the mainDataset of your subreport is empty. This way you can have some sort of place holder when there is nothing to display.

How to apply conditional style when group changes?

There are lots of tutorials on how to zebra stripe the rows of a report. Like this:
+-------+-------+
| Value | Color |
+-------+-------+
| A | white |
| A | black |
| B | white |
| B | black |
| B | white |
| C | black |
| D | white |
| D | black |
+-------+-------+
But what I want to do is a grouped stripping. Like this:
+-------+-------+
| Value | Color |
+-------+-------+
| A | white |
| A | white |
| B | black |
| B | black |
| B | black |
| C | white |
| D | black |
| D | black |
+-------+-------+
I'm using the column "Value" as the expression of a group and my data is sorted by "Value". "black" is a black rectangle to be printed when the group is black. "white" is the absence of the black rectangle. I want a variable that I can put in "Print When Expression" of the black rectangle.
What I've tried until now:
Create a variable $V{print}
Initial Value Expression: false
Variable Expression: !$V{print}
Increment type: Group
Increment group: Value
I expected the value of $V{print} to change to it's opposite value every time the group changed. What I get is the normal striped list (black, white, black, white...)
The problem with you current solution is:
calculationType="Nothing"
Nothing: This is the default calculation type that a variable performs. It means that the variable's value is recalculated with every iteration in the data source and that the value returned is obtained by simply evaluating the variable's expression.
This type of calculation will invalidate your incrementType, hence the incrementType has no effect, since we are not calculating. This is why currently you get black,white,black,white.
This will achieve your desired result
Variable definition (lets do some calculation example increment by 1 every time group change, sum or count)
<variable name="GroupCnt" class="java.lang.Integer" incrementType="Group" incrementGroup="myGroup" calculation="Sum">
<variableExpression><![CDATA[1]]></variableExpression>
</variable>
conditionExpression (we can use modulus operator the variable GroupCnt)
<conditionExpression><![CDATA[$V{GroupCnt}%2==0]]></conditionExpression>
Example of complete jrxml (I have added an rectangle as OP comment on this)
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="group" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c1d9b4b7-6162-4b17-b871-3cf3b867d1ef">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="myStyle">
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{GroupCnt}.intValue()%2==0)]]></conditionExpression>
<style mode="Opaque" forecolor="#FFFFFF" backcolor="#000000"/>
</conditionalStyle>
</style>
<field name="Value" class="java.lang.String"/>
<variable name="GroupCnt" class="java.lang.Integer" incrementType="Group" incrementGroup="myGroup" calculation="Sum">
<variableExpression><![CDATA[1]]></variableExpression>
</variable>
<group name="myGroup">
<groupExpression><![CDATA[$F{Value}]]></groupExpression>
</group>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement style="myStyle" x="0" y="0" width="150" height="20" uuid="7ca1ac35-6249-4ba6-ac87-031f8d410d2e"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{Value}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement style="myStyle" x="150" y="0" width="150" height="20" uuid="d322e0df-0d39-4370-90e6-58305d449852"/>
</rectangle>
</band>
</detail>
</jasperReport>
new Boolean($V{GroupCnt}.intValue()%2==0), new Boolean and intValue() is just use to be compatibile with old jasper report versions it is not needed in latest versions
Result

Why only one row is showing in report?

In MySQL workbench I get 3 rows:
mysql> select * from person;
+-----+------+
| ID | NAME |
+-----+------+
| A01 | A01 |
| A02 | A02 |
| A03 | A03 |
+-----+------+
3 rows in set (0.00 sec)
but when I use jrxml and show to pdf
I just can get a one row
+-----+------+
| ID | NAME |
+-----+------+
| A01 | A01 |
+-----+------+
and this's my jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="T0113" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" >
<queryString>
<![CDATA[select * from person ]]>
</queryString>
<field name="ID" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="NAME" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<group name="ID">
<groupExpression><![CDATA[$F{ID}]]></groupExpression>
</group>
<group name="NAME">
<groupExpression><![CDATA[$F{NAME}]]></groupExpression>
</group>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="240" y="0" width="100" height="30" />
<text><![CDATA[PDFPDF]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="61" splitType="Stretch">
<textField>
<reportElement x="170" y="15" width="100" height="30" />
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="320" y="10" width="100" height="30" />
<textFieldExpression><![CDATA[$F{NAME}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
</jasperReport>
So how to fix the problem ?
This is because you field's are in the wrong band.
Column Header This section appears at the beginning of each column in
the generated document.
Detail This section is repeated for each line of data supplied by the
report's data source. The detail section can be made of multiple
bands.
Currently you have them in the columnHeader you need to but them in the detail band
<detail>
<band height="61" splitType="Stretch">
<textField>
<reportElement x="170" y="15" width="100" height="30" />
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="320" y="10" width="100" height="30" />
<textFieldExpression><![CDATA[$F{NAME}]]></textFieldExpression>
</textField>
</band>
</detail>
To learn more about different report sections see Tutorial report section and JRBand API
just change <![CDATA[$F{ID}]]> and <![CDATA[$F{NAME}]]> in the detail band NOT in columnHeader