jasper ireport first record

1

My report in Jasper ireport only displays the first record

Code

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<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="Blank_Letter" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c48467be-87c9-4ccb-90b9-fcfa33a9d84f">
    <property name="com.jaspersoft.studio.data.sql.tables" value="YmFuY290ZXN0ZS5jbGllbnRlICwxNSwxNSxlNTU0NDA1OS0xYzI5LTQwMzAtYjVkNC03YTFiYjUzNjMxMWY7"/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="mysqlxampp"/>
    <queryString language="SQL">
        <![CDATA[SELECT * FROM bancoteste.cliente]]>
    </queryString>
    <field name="nome" class="java.lang.String"/>
    <field name="idade" class="java.lang.String"/>
    <field name="codigo" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch">
            <staticText>
                <reportElement x="230" y="0" width="120" height="30" uuid="d12daa5e-ea80-4790-8af5-25c99f14b6db"/>
                <textElement>
                    <font size="18"/>
                </textElement>
                <text><![CDATA[RELATORIO]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="61" splitType="Stretch">
            <staticText>
                <reportElement x="356" y="0" width="100" height="20" uuid="6649fe5c-d657-4d3d-b672-2f44fc082ea3"/>
                <text><![CDATA[codigo]]></text>
            </staticText>
            <staticText>
                <reportElement x="0" y="0" width="100" height="20" uuid="9fef867a-3cbe-4c85-9d4e-daee2441b491"/>
                <text><![CDATA[nome]]></text>
            </staticText>
            <staticText>
                <reportElement x="180" y="0" width="100" height="20" uuid="4be07db8-dd06-4db7-9dae-f2b5712167de"/>
                <text><![CDATA[idade]]></text>
            </staticText>
            <textField>
                <reportElement x="356" y="20" width="100" height="19" uuid="237beee7-de42-446c-b966-26d53164f46a"/>
                <textFieldExpression><![CDATA[$F{codigo}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="0" y="20" width="100" height="19" uuid="487128c2-8ed2-4e64-ad5f-d03e7cf8c5ce"/>
                <textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="180" y="20" width="100" height="19" uuid="5a4e7139-82d7-462a-b121-466dc8ac0e3c"/>
                <textFieldExpression><![CDATA[$F{idade}]]></textFieldExpression>
            </textField>
        </band>
    </columnHeader>
    <detail>
        <band height="125" splitType="Stretch"/>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

    
asked by anonymous 30.09.2017 / 02:52

1 answer

1

This error is occurring because you have placed your fields in the "Header" section, the correct one is to put them in "Detail". You move the column headings to the column header, ie your Static Texts and the textFields are in the detail part just below the headings.

This gives a report like this:

+---------------------------------------------------------+
|                      Relatório  (Pg1)                   |
+-----------+----------+----------+-----------------------+
|  Coluna 1 | Coluna 2 | Coluna 3 |       Column Header   |
+-----------+----------+----------+-----------------------+
| TextField |TextField |TextField |                       |
| TextField |TextField |TextField |       Detail          |
| TextField |TextField |TextField |                       |

.... Pg 2

+-----------+----------+----------+-----------------------+
|  Coluna 1 | Coluna 2 | Coluna 3 |       Column Header   |
+-----------+----------+----------+-----------------------+
| TextField |TextField |TextField |                       |
| TextField |TextField |TextField |       Detail          |
| TextField |TextField |TextField |                       |

Or you might want static texts to be some sort of caption for the data, so you would do so

+----------------------------------------------+----------+
|                 Relatório (Title)            |          |
+----------------------------------------------+----------+
|  Nome: (Static Text) ZZZZZZ (TextField)      |          |
|  Endereço: (Static Text) ZZZZZZ (TextField)  |  Detail  | 

Except for mistake the difference between this ColumnHeader section and the Title is that the first one repeats in all the pages, since Title only appears on the first page.

    
30.09.2017 / 04:20