Why does the detail-band grow on second page? - jasper-reports

I'm defining a report for invoices, an invoice may have n items (rows) in the detail. I defined a dataset in order to display the items without the need of a subreport. Here my Detail-band:
<detail>
<band height="275" splitType="Stretch">
<rectangle>
<reportElement x="0" y="0" width="60" height="16" uuid="590f4cac-fba0-4e0b-aa74-db059a817946"/>
</rectangle>
<rectangle>
<reportElement x="60" y="0" width="140" height="16" uuid="1cc31301-e884-4648-952d-a68bcaa12b23"/>
</rectangle>
<rectangle>
<reportElement x="200" y="0" width="31" height="16" uuid="ac690ad3-a913-454f-80d0-574505609db1"/>
</rectangle>
<rectangle>
<reportElement x="231" y="0" width="100" height="16" uuid="6d623fd0-df6f-4ffd-b92b-8f18e0d2d5b2"/>
</rectangle>
<rectangle>
<reportElement x="331" y="0" width="37" height="16" uuid="afef801a-3280-4810-8d85-c1f591d2b75b"/>
</rectangle>
<staticText>
<reportElement x="3" y="2" width="44" height="11" uuid="f525bb2b-106a-44a3-9fb0-817f1eeb8260"/>
<textElement>
<font size="6"/>
</textElement>
<text><![CDATA[Artikel]]></text>
</staticText>
<staticText>
<reportElement x="63" y="2" width="126" height="11" uuid="0f97aa9e-cb83-4a95-92fc-fdc01e1506f1"/>
<textElement>
<font size="6"/>
</textElement>
<text><![CDATA[Beschreibung]]></text>
</staticText>
<staticText>
<reportElement x="207" y="2" width="22" height="11" uuid="6234d14c-abe2-482e-b6bb-f1c65dc19005"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<text><![CDATA[Menge]]></text>
</staticText>
<staticText>
<reportElement x="237" y="2" width="92" height="11" uuid="2bd9712e-b8be-4b90-823d-a530f6c7dcba"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<text><![CDATA[Einheitspreis]]></text>
</staticText>
<staticText>
<reportElement x="340" y="2" width="25" height="11" uuid="dbf02042-62f2-4b70-9b8b-fae588cb8055"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<text><![CDATA[Rabatt]]></text>
</staticText>
<rectangle>
<reportElement x="368" y="0" width="70" height="16" uuid="54f1f443-d742-4287-8ae6-d06b04682bf4"/>
</rectangle>
<rectangle>
<reportElement x="437" y="0" width="34" height="16" uuid="f23aa7d5-3eb9-478a-a799-a8acfe96d7af"/>
</rectangle>
<rectangle>
<reportElement x="471" y="0" width="84" height="16" uuid="7b4a3a55-b161-44c7-8512-33a127d68ba3"/>
</rectangle>
<staticText>
<reportElement x="381" y="2" width="54" height="11" uuid="e12d9869-3dcd-4b81-89f8-b3a3c6b2e28c"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<text><![CDATA[MwSt. Grundlage]]></text>
</staticText>
<staticText>
<reportElement x="441" y="2" width="28" height="11" uuid="fb7f8a0e-1632-454f-9742-5179831c8dc4"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<text><![CDATA[MwSt.]]></text>
</staticText>
<staticText>
<reportElement x="505" y="2" width="47" height="11" uuid="da9a079f-dc7e-4fef-9f31-eabd65340967"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<text><![CDATA[MwSt. Betrag]]></text>
</staticText>
<rectangle>
<reportElement x="0" y="16" width="60" height="248" uuid="cd7f5e9a-aeae-425c-8783-22084707b432"/>
</rectangle>
<rectangle>
<reportElement x="60" y="16" width="140" height="248" uuid="01ee9155-aed8-4a55-8160-5f73ac6b1085"/>
</rectangle>
<rectangle>
<reportElement x="200" y="16" width="31" height="248" uuid="66698906-69ee-4fdc-8a04-ce14372bd065"/>
</rectangle>
<rectangle>
<reportElement x="231" y="16" width="100" height="248" uuid="0c260fbe-b300-4962-ad7b-ff7666fa2baa"/>
</rectangle>
<rectangle>
<reportElement x="331" y="16" width="37" height="248" uuid="1902828b-f84c-440c-8e3f-24cdffea33ec"/>
</rectangle>
<rectangle>
<reportElement x="368" y="16" width="69" height="248" uuid="880c1b82-4316-493a-b5b3-c4342bbb74c9"/>
</rectangle>
<rectangle>
<reportElement x="437" y="16" width="34" height="248" uuid="ee1c4e69-b69e-4cc8-9b83-24e9867012de"/>
</rectangle>
<rectangle>
<reportElement x="471" y="16" width="84" height="248" uuid="eade602d-0afa-4a6e-a3aa-5de350dc2ee5"/>
</rectangle>
<componentElement>
<reportElement x="0" y="16" width="555" height="17" uuid="be7e1e99-0990-4f3d-beaf-b304c08be036"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="items" uuid="ab906203-20bb-4347-806b-ef000f212bf9">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{righeDocumento})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="17" width="555">
<textField>
<reportElement x="3" y="2" width="56" height="14" uuid="448ef958-9459-4ab1-8896-f5b65dd7a552"/>
<textFieldExpression><![CDATA[$F{articolo}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="63" y="2" width="136" height="14" uuid="24634427-d38f-4679-8996-a96d5051774b"/>
<textFieldExpression><![CDATA[$F{descrizione}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="236" y="2" width="92" height="14" uuid="20bda0b8-a3c0-47e7-bdff-555c481a894d"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[new DecimalFormat("0.00 €").format($F{prezzo})]]></textFieldExpression>
</textField>
<textField>
<reportElement x="207" y="2" width="21" height="14" uuid="61766ba4-57d0-4509-ac41-ffd7bb4e12ef"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{quantita}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="338" y="2" width="27" height="14" uuid="535705c6-d0b6-401d-b767-efafb3ba42f7"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{sconto} == null ? "" : $F{sconto}+" %"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="439" y="2" width="28" height="14" uuid="0dc5fa14-efac-4c5b-898a-9a9152e588f7"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{aliquota}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="375" y="2" width="59" height="14" uuid="2772b49b-5355-463d-bebf-856537a416a3"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[new DecimalFormat("0.00 €").format($F{costo})]]></textFieldExpression>
</textField>
<textField>
<reportElement x="482" y="2" width="70" height="14" uuid="0259a153-a0c2-4589-b296-fdca4ceeed2b"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[new DecimalFormat("0.00 €").format($F{iva})]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
The result is to see in the following pictures:
Example with many rows:
Example with two rows:
The problem is that when I have more rows it includes a second page (not shown here in my question) with header and footer, the detail is empty. The rest as we can see from the pics is OK.
Why? How do I fix it?

You have chosen a strange way to create this report, the normal way would be to make the detail band represent 1 article line in your invoice (hence detail band would have the height of 14)
Then if you need to draw lines to the bottom of the page you can always use the background band.
What is happening now?, probably the list overflows in your detail band that also have empty space under it, it can not create another one on same page and move the space to next page.
Solution Use the normal way of jasper report, datasource containing your lines, header in columnHeader band, fields in detail band (height 14) and your vertical lines in
the background band, also exports as to excel etc will be much cleaner.
If you like to keep your list, move all the rectangles to the
background band and reduce height of detail band to remaining
components (header + list height)

Related

Jasper report table can't fit on the current page

I have a Jasper report that is iterating over a list of data returned by a query and displaying the data in tabular format. Depending on the number of table rows the contents of the table might be split across two pages.
Is there a way to prevent this data splitting and cause the entire table to appear on the next page if it doesn't all fit on the current page?
The detail band of my report is as follows:
<detail>
<band height="100" splitType="Prevent">
<componentElement>
<reportElement x="0" y="0" width="800" height="20" isPrintWhenDetailOverflows="true" uuid="3e389075-14ca-4f57-9d02-175fbc34a639"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="output" uuid="acf7113d-1f5a-4acc-ad2c-70efb491bb4f">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{output})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="60" width="800">
<textField>
<reportElement isPrintRepeatedValues="false" x="0" y="20" width="555" height="20" uuid="156e4ef8-b8d9-4dc4-8a50-4f27e0f36a83"/>
<textFieldExpression><![CDATA[$F{reference}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement x="0" y="40" width="200" height="20" uuid="3e389075-14ca-4f57-9d02-175fbc34a639"/>
<jr:list printOrder="Vertical">
<datasetRun subDataset="unitDetails" uuid="acf7113d-1f5a-4acc-ad2c-70efb491bb4f">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{units})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="40" width="800">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="ead7d8ba-12e2-4a0e-af92-66a50b34148f"/>
<textFieldExpression><![CDATA[$F{businessUnit}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement x="0" y="20" width="800" height="20" uuid="85e29233-08b3-4717-b260-82c9e4a003c5"/>
<jr:table>
<datasetRun subDataset="codeDetails" uuid="1f5dfa57-f961-4574-b663-8637b2aa6f6e">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{codes})]]></dataSourceExpression>
</datasetRun>
<jr:column width="100" uuid="f832562c-1459-44a4-89df-fe5feadfe7ee">
<jr:detailCell height="20">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="e2ce6b92-bf8a-45f8-936a-af99b2ced4e7"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="150" uuid="b8c51d7d-f4d2-47c9-90a8-2449dff2a9f9">
<jr:columnHeader height="20">
<staticText>
<reportElement x="0" y="0" width="150" height="20" uuid="2fc57842-d68d-4398-a0df-4eddd74316fd"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Total]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20">
<textField>
<reportElement x="0" y="0" width="150" height="20" uuid="b2953321-ce5d-4e5f-94e3-8b48b49bbf90"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="150" uuid="f8e255a7-951d-43ad-962b-f4ee32efaa80">
<jr:columnHeader height="20">
<staticText>
<reportElement x="0" y="0" width="150" height="20" uuid="69deede1-0fbc-4fd0-b430-4f0f3cacdc4f"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Approved]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20">
<textField>
<reportElement x="0" y="0" width="150" height="20" uuid="200263e0-f9fb-4626-8cee-3eb838d51add"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{approved}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="150" uuid="b4d8feb1-4134-4302-bad1-902685238d3e">
<jr:columnHeader height="20">
<staticText>
<reportElement x="0" y="0" width="150" height="20" uuid="096581a7-beec-43bc-a17e-ce96c4384838"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Rejected]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20">
<textField>
<reportElement x="0" y="0" width="150" height="20" uuid="3c5d019f-c4af-479b-b180-d52a6606d4e0"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{rejected}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
The report output looks like the following where the bottom of the page has the table headings but not the contents because the contents don't fit.

JaspeReports Table Row Print Error

The objective of my study is to print a table that I have on SQL Server, the data connecting is done, the interface and the printing are done too.
The problem occurs when I print the PDf of the report because I want to print a number of rows per page but it only prints me one row of the table per page, so if my table has 205 rows, it prints 205 pages, haha, kinda weird.
This is my first time using JasperReports. Here is my jrxml file.
<?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="listadoCensosDiarios" language="groovy" printOrder="Horizontal" pageWidth="2400" pageHeight="1000" orientation="Landscape" columnWidth="2360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d8233986-9ca6-4eb9-852a-0c0bf896d505">
<parameter name="ruta" class="java.lang.String"/>
<field name="CodigoCama" class="java.lang.String"/>
<field name="Documento" class="java.lang.String"/>
<field name="Nombre" class="java.lang.String"/>
<field name="Edad" class="java.lang.String"/>
<field name="Empresa" class="java.lang.String"/>
<field name="Especialista" class="java.lang.String"/>
<field name="Diagnostico" class="java.lang.String"/>
<field name="FechaIngreso" class="java.lang.String"/>
<field name="Dias" class="java.lang.String"/>
<field name="Dieta" class="java.lang.String"/>
<field name="Observaciones" class="java.lang.String"/>
<field name="Registrado" class="java.lang.String"/>
<field name="FechaRegistro" class="java.lang.String"/>
<variable name="totalPaginas" class="java.lang.Integer" resetType="Page" incrementType="Report" calculation="Count"/>
<title>
<band height="58" splitType="Stretch">
<rectangle>
<reportElement uuid="df0fa9dd-b7f1-4800-b1bf-f40de1bc7263" x="64" y="1" width="1801" height="50" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f773ff3c-e683-41f4-8f16-7d8c66d54562" mode="Opaque" x="64" y="2" width="1801" height="48" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="20" isBold="true"/>
</textElement>
<text><![CDATA[CENSO DIARIO]]></text>
</staticText>
<rectangle>
<reportElement uuid="07b7d0a3-0b20-4649-a1b2-0045ca40372e" x="1" y="1" width="63" height="50" backcolor="#E0E0E0"/>
</rectangle>
<rectangle>
<reportElement uuid="e076ba71-8906-4238-a19d-f75077425de6" x="1865" y="1" width="134" height="50" backcolor="#E2DEDE"/>
</rectangle>
<image hAlign="Center" vAlign="Middle">
<reportElement uuid="e0c8b5d2-3f68-4895-adea-e98d58a2ea3e" x="1" y="2" width="63" height="47"/>
<imageExpression><![CDATA[$P{ruta}+"//img//LOGO1.png"]]></imageExpression>
</image>
<image hAlign="Center" vAlign="Middle">
<reportElement uuid="ce929fc5-57d6-4e20-b30c-9893f34edf61" x="1901" y="3" width="58" height="46"/>
<imageExpression><![CDATA[$P{ruta}+"//img//100calidad.jpg"]]></imageExpression>
</image>
</band>
</title>
<pageHeader>
<band height="24" splitType="Stretch">
<rectangle>
<reportElement uuid="b28a6cd6-7bb8-4332-a443-795537750291" x="0" y="8" width="1629" height="16" backcolor="#D3ECC7"/>
</rectangle>
<rectangle>
<reportElement uuid="da28e036-684a-4921-a42a-4afab1ff613a" x="1629" y="8" width="370" height="16" backcolor="#D3ECC7"/>
</rectangle>
<staticText>
<reportElement uuid="4ec9e82c-884b-49ea-9d84-41ef79374f2d" mode="Opaque" x="1632" y="10" width="360" height="14" backcolor="#D3ECC7"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Información del Empleado]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="23" splitType="Stretch">
<rectangle>
<reportElement uuid="0ed0631b-b8b3-4544-984a-6a8b152405a4" x="145" y="1" width="169" height="22" backcolor="#E0E0E0"/>
</rectangle>
<rectangle>
<reportElement uuid="5d9afa11-5f66-4c24-a689-790b6bbbfee8" x="0" y="1" width="52" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="d3cbfe71-89c2-40f4-83be-c388d60d1f57" mode="Transparent" x="10" y="0" width="39" height="22" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Cama]]></text>
</staticText>
<rectangle>
<reportElement uuid="6e7ec76b-c44c-4ae1-8b14-868e9f596876" x="314" y="1" width="35" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="afc00f8f-d646-48be-b883-11beb5e4e5b3" x="318" y="1" width="25" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Edad]]></text>
</staticText>
<rectangle>
<reportElement uuid="065d81fe-b21e-4982-9843-c874f499a969" x="349" y="1" width="150" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="1215c9ac-9bc5-428d-9456-4c9c0ce81129" x="351" y="1" width="145" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Empresa]]></text>
</staticText>
<rectangle>
<reportElement uuid="9066f537-b0d4-4a43-b544-14704b4fc207" x="499" y="1" width="150" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="6ba919d0-8dc8-421e-890d-4d9e9bcdf639" x="501" y="1" width="146" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Especialista]]></text>
</staticText>
<rectangle>
<reportElement uuid="efeb1184-587c-43ce-bca3-3e6b25f10ea6" x="649" y="1" width="206" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="bc197cfe-a855-4da3-b25e-2d602e16e5c5" x="670" y="1" width="164" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Diagnostico]]></text>
</staticText>
<rectangle>
<reportElement uuid="b9dadc2e-8f0d-481d-a82d-f6f47263ef18" x="855" y="1" width="209" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="7c51754f-552c-445e-b7f4-668375f96f3b" x="868" y="1" width="183" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Fecha Ingreso Paciente]]></text>
</staticText>
<rectangle>
<reportElement uuid="efe37924-5b8b-46bb-b7ab-c35ec15f16f7" x="1173" y="1" width="156" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="4360b926-3429-4bcf-bf76-28c6ed3af80f" x="1219" y="1" width="65" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dieta]]></text>
</staticText>
<rectangle>
<reportElement uuid="53b0b7be-341c-4d88-9d06-e9ce66f2ba38" x="1329" y="1" width="300" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="739a0a28-415c-4f19-97e7-0eb4d1967f0c" x="1346" y="1" width="269" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Observaciones]]></text>
</staticText>
<rectangle>
<reportElement uuid="5c0eb8ea-abbb-430f-8faf-bdc507ccdc43" x="1064" y="1" width="109" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f620ed1e-a0a1-448f-a9cd-13b0824dda53" x="1064" y="1" width="98" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Dias Estancia]]></text>
</staticText>
<rectangle>
<reportElement uuid="f0ac1173-7313-46cb-bf0c-072abc746810" x="1629" y="1" width="250" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f0650ba4-1a18-4ff8-b514-928fad9c0e47" x="1629" y="1" width="250" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Registrado Por]]></text>
</staticText>
<rectangle>
<reportElement uuid="ea2a4a77-fe25-4b62-8730-b04158cc4f43" x="1879" y="1" width="120" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="051cd84a-f45a-43ae-8e50-476a1723acdd" x="1879" y="1" width="120" height="22"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Fecha Registro]]></text>
</staticText>
<rectangle>
<reportElement uuid="146c7aa0-b3cd-496d-a9c7-49b74c37bd64" x="52" y="1" width="93" height="22" backcolor="#E0E0E0"/>
</rectangle>
<staticText>
<reportElement uuid="f657cfd7-da85-4e30-86ec-720183dbd38b" mode="Transparent" x="52" y="1" width="93" height="22" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[Documento]]></text>
</staticText>
<staticText>
<reportElement uuid="64287559-c995-45ba-b97f-dbfbecf62eab" mode="Transparent" x="145" y="2" width="169" height="21" backcolor="#E0E0E0"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Nombre(s) y Apellidos]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="626" splitType="Stretch">
<rectangle>
<reportElement uuid="ce513dc9-595a-4018-9b60-4184a87400cf" x="52" y="0" width="93" height="59"/>
</rectangle>
<rectangle>
<reportElement uuid="633a32fe-76d0-478c-a2e8-ef73630b698d" x="0" y="0" width="52" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="d1b97bd4-4e00-4aae-a0eb-d9532314933f" x="3" y="0" width="46" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{CodigoCama}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="58f022c4-755c-4341-9de7-152dbb01092b" x="145" y="0" width="169" height="59"/>
</rectangle>
<rectangle>
<reportElement uuid="9236e426-7562-40b9-8c87-02a31d29dacf" x="314" y="0" width="35" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="d77071b7-c1cc-40e8-ab57-92ad08278390" x="316" y="0" width="29" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Edad}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="76fa21b9-c41d-46bc-8c50-dee329b8c61c" x="349" y="0" width="150" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="81c4e8ba-6de5-471d-b8ca-3e9984105a99" x="354" y="0" width="140" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Empresa}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="836b0a1d-4268-4668-a63e-4df1b4834662" x="499" y="0" width="150" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="e0ee8d88-5ef1-4e7e-b534-c5cef786c942" x="505" y="0" width="140" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Especialista}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="49535787-c02d-4d34-9b83-ed192e0fb086" x="855" y="0" width="209" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="0a4641d9-76f8-4081-ba53-7d68e9934176" x="865" y="0" width="190" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{FechaIngreso}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="e4187b85-1c21-4041-8e0e-2c1a6f02cb72" x="1173" y="0" width="156" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="7883fd8a-e3f2-4930-8ec0-37fdb76f4fa4" x="1184" y="0" width="132" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Dieta}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="1a80ef21-1caa-46c2-a1ff-69a810997625" x="1329" y="0" width="300" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="cb697e3d-c8e0-4c98-a588-1eb92008d1f5" x="1345" y="0" width="269" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Observaciones}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="6e960357-27ac-4411-b0ab-1dc6c2bc101b" x="1064" y="0" width="109" height="59"/>
</rectangle>
<rectangle>
<reportElement uuid="3eca5ca2-a90b-4c1c-96d4-2ff47b699044" x="1879" y="0" width="120" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="548dcabc-6708-4a4b-902a-7fd7cc30f26c" x="1897" y="0" width="93" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{FechaRegistro}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="2cc8851f-d3b4-44cf-a97c-4ad7544765b5" x="59" y="0" width="79" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Documento}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="641978c2-69fc-45f3-a96c-25a53aa138b5" x="1629" y="0" width="250" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="66b12f81-615c-4bb7-8c18-3ce2f0e877d6" x="1635" y="0" width="236" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Registrado}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="0a4641d9-76f8-4081-ba53-7d68e9934176" x="1069" y="1" width="98" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Dias}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="8e458e73-d0fb-4707-b4b8-dd34642725af" x="151" y="1" width="155" height="59"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Nombre}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement uuid="e021e007-7a56-4ebe-a617-ab39f21dbb32" x="649" y="0" width="206" height="59"/>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement uuid="61d0b9e9-f314-44a3-8aa4-ead1d3e726b6" x="659" y="0" width="185" height="58"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{Diagnostico}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="140" splitType="Stretch"/>
</pageFooter>
</jasperReport>
I tried with a page break but I got the same result.
Your detail band is too tall. Set its height to match the tallest element in the band, that is 59 pixels.

Crosstab table is not incrementing in jasper report

I have try to generated table from query using pivot. But when i tried to compile, the row is incremented but the colomn not increment. I have try to generated the query to pivot table in adf, and the colomn is generated. This is my code:
<band height="303">
<crosstab>
<reportElement x="1" y="0" width="499" height="200" uuid="77f9d29c-5ef4-4cd8-8b35-c18e7a70831d"/>
<rowGroup name="KOMPETENSI1" width="60">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{KOMPETENSI}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab 2_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="9cebd928-d666-4221-99bf-ef5a6d917ab1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{KOMPETENSI1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="2975a46b-27d0-4e72-aec0-9e4116cee446"/>
<text><![CDATA[Total KOMPETENSI1]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="TAHUN1" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{TAHUN}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab 2_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="8f43f54c-6de3-407b-b36f-34d3b559cc02"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{TAHUN1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="6a20de24-7100-495f-9e85-c82d9924e69a"/>
<text><![CDATA[Total TAHUN1]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="JOB1" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{JOB}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab 2_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="18d62d4b-e2e9-4ecf-b68a-f97f436d571d"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{JOB1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="68d57411-4634-4383-aaa6-a7f6f4fa8c8f"/>
<text><![CDATA[Total JOB1]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="JENJAB1" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{JENJAB}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab 2_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="a46d026b-99c0-44c1-a7f0-b1b1deb8ea45"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{JENJAB1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="2b6f1d48-25aa-4345-9725-6065a99c72cc"/>
<text><![CDATA[Total JENJAB1]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="LEVEL_JOB_MEASURE1" class="java.lang.String">
<measureExpression><![CDATA[$F{LEVEL_JOB}]]></measureExpression>
</measure>
<measure name="LEVEL_KOMPETENSI_MEASURE1" class="java.lang.String">
<measureExpression><![CDATA[$F{LEVEL_KOMPETENSI}]]></measureExpression>
</measure>
<crosstabCell width="60" height="20">
<cellContents mode="Opaque" style="Crosstab 2_CD">
<textField>
<reportElement x="0" y="0" width="60" height="10" uuid="8d786258-a3ba-447e-b7a6-d515b3b83495"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" uuid="a052bd65-583b-4e65-ba9c-fb705fa8762e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="TAHUN1">
<cellContents mode="Opaque" style="Crosstab 2_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="10f3a0a6-8da7-4eea-bd76-080ec3ac457d"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="ff6b097f-377b-450d-9f31-c2d615c689f0"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="JOB1">
<cellContents mode="Opaque" style="Crosstab 2_CG">
<textField>
<reportElement x="0" y="0" width="60" height="10" uuid="d26f9674-e4c4-4ffb-8cc5-b4b83c2e5000"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" uuid="9cb43185-e1e8-42f9-8ba7-ec6b31a4f3f2"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="JENJAB1">
<cellContents mode="Opaque" style="Crosstab 2_CG">
<textField>
<reportElement x="0" y="0" width="60" height="10" uuid="b40177ac-bbc2-416e-969c-8f21007ee4b6"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" uuid="814d6eff-61a6-430c-a2bf-fa2a92467496"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1">
<cellContents mode="Opaque" style="Crosstab 2_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="eedbded2-f179-4d9c-a38a-0e188854a3c4"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="2fd20c2a-8472-41d9-bef1-aa5ae54c1332"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="TAHUN1">
<cellContents mode="Opaque" style="Crosstab 2_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="524a4a98-6e1c-4d4b-974b-ce12dd00afd9"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="7b5692a4-9bc7-4499-9c52-c3cac33ff921"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="JOB1">
<cellContents mode="Opaque" style="Crosstab 2_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="40ad1b84-ff41-46e1-b7c2-85a347a72ae3"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="f2b21bb4-1125-4e3d-8476-dfbc846bd2f6"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="JENJAB1">
<cellContents mode="Opaque" style="Crosstab 2_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="ab621e9e-d237-46db-96a2-2203c54ef55a"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="f806f467-6c8c-4dcb-a05c-f7f181b0b064"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
This is my result pivot table:
I want the result like this:
If you see, the year of the table is not increment, how to fix it?
the query:
select CASE WHEN (JENJAB like 'SEVP') THEN '4'
WHEN (JENJAB like 'EVP') THEN '4' WHEN (JENJAB like 'SVP') THEN '4'
WHEN (JENJAB like 'SVP') THEN '4' WHEN (JENJAB like 'AVP') THEN '3'
WHEN (JENJAB like 'AVP') THEN '2' END AS LEVEL_JOB, kompetensi,
level_kompetensi, tahun, job, jenjab from OL_ASSESSMENT_RESULT
where tahun in (select tahun from ( select distinct tahun
from OL_ASSESSMENT_RESULT order by tahun desc)
where ROWNUM <=3 ) and npp = $P{npp}
The result of query:

Stretch text field with data overflow

I have 9 text fields, I want to stretch all these text fields with data overflow. In my case, for all text fields I set position type to 'float' and I checked 'stretch with overflow'. And I put each row in Frame.
But I got a bad design, so I want to align the text fields relating to values 2 and 3 with the others texts fields.
Example : enter link description here
Thanks in advance.
Best Regards.
You cannot have an option to adjust the position of the text based on the fields in Left and Right. Also from your design, I can imagine that the Left and Right text boxes are inside List component or Table component.
Position of text boxes inside List or Table component cannot be adjusted based on the position of text boxes which are not inside the table or list component.
Posting a proper design or sample JRXML might be helpful to solve your problem.
Problem is solved :
I created Frame and group selected elements for each row.
<frame>
<reportElement uuid="70cb42df-4e8f-4cbc-8d8f-f86a4aef9e3d" positionType="Float" x="119" y="233" width="332" height="20" isPrintWhenDetailOverflows="true"/>
</frame>
<frame>
<reportElement uuid="4ca6a014-3eca-4c16-ae4e-079216b1e010" positionType="Float" x="119" y="253" width="332" height="20" isPrintWhenDetailOverflows="true"/>
</frame>
<elementGroup>
<textField isStretchWithOverflow="true">
<reportElement uuid="b6102d47-3114-4673-a241-4dddb0e556bd" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="133" y="213" width="100" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["1"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="c22b46b5-e528-4bb5-ad1c-a5fca06faf38" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="383" y="213" width="55" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["value 1"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="66833d4b-1a6b-4398-9431-ed3ef80ef7dc" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="233" y="213" width="150" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["azertyuiop aaaaaaaaaaaaaaazeeeeeeerrrrrrrrrrrrtttttttttttttttttttttpmmmmmmmmmmmmmlk"]]></textFieldExpression>
</textField>
</elementGroup>
<frame>
<reportElement uuid="bc738f1d-150b-4959-9bc5-6a00b7112969" positionType="Float" x="119" y="213" width="332" height="20" isPrintWhenDetailOverflows="true"/>
</frame>
<elementGroup>
<textField isStretchWithOverflow="true">
<reportElement uuid="78d019fd-5e89-47f1-a895-9a4f0f754000" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="133" y="233" width="100" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["2"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="5935ad61-77ec-4b05-84bf-6f72d3dcd0bd" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="233" y="233" width="150" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["DP-GI"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="83d4865c-f1af-4361-b6fd-9575a9835c7f" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="383" y="233" width="55" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["value 2"]]></textFieldExpression>
</textField>
</elementGroup>
<elementGroup>
<textField isStretchWithOverflow="true">
<reportElement uuid="1a2694c6-974b-493a-b0a6-09b2be10f63a" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="133" y="253" width="100" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["3"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="450e7cce-5a49-4bbc-b502-d86352c7c873" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="233" y="253" width="150" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["AS-GE"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement uuid="d8e7b402-0081-46ca-bd1c-2c3ae992b957" style="table" positionType="Float" stretchType="RelativeToTallestObject" x="383" y="253" width="55" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA["value 3"]]></textFieldExpression>
</textField>
</elementGroup>
Here is the result : enter link description here
Best Regards.

How to set x, y for a textElement in JasperReports depending on if above textElement is empty. And if non-empty show it down to the that textelement

Requirement:
If firstName and lastName is non empty. Show this at x=125, y=3 coordinates.
And show address down to it at x="125" y="26" coordinate. This is working fine.
Problem: If firstName/lastName are empty, Then we need to move the address element up and show it at x=125, y=3 coordinate itself.
This is where I am stuck. Please help me.
Please refer my jrxml file below:
<frame>
<reportElement key="frame-462" positionType="Float" mode="Transparent" x="0" y="50" width="390" height="70"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now">
<reportElement key="textField-844" positionType="Float" mode="Transparent" x="125" y="3" width="264" height="23"
isPrintWhenDetailOverflows="true" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[(!$F{firstName}.isEmpty() && !$F{lastName}.isEmpty())]]></printWhenExpression>
</reportElement>
<textElement markup="styled">
<font fontName="Verdana" size="12"/>
</textElement>
<textFieldExpression>
<![CDATA[$F{firstName} + "<style pdfFontName='Helvetica-Oblique' size='11'>" + $F{lastName} + "</style>"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now">
<reportElement key="textField-843" mode="Transparent" positionType="Float" x="125" y="26" width="264"
height="42" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>
<textElement markup="html">
<font fontName="Verdana" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<staticText>
<reportElement key="staticText-1249" positionType="Float" x="2" y="2" width="108" height="21"
isRemoveLineWhenBlank="true"/>
<textElement textAlignment="Left">
<font fontName="Verdana" size="12" isBold="false" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[ Address:]]></text>
</staticText>
</frame>
You have already set the isRemoveLineWhenBlank attribute, which will remove the empty space left by the textField. However, JasperReports cannot collapse vertical space unless that space is completely clear. If there is another element occupying the same line (in your case the staticText element), the empty space will be preserved. This is a bit like playing Tetris in reverse; You have to get rid of all of the blocks before the line will disappear.
Putting report elements into frames modifies this behaviour slightly. It is only the width of the parent frame that needs to be clear, instead of the width of the whole report. Therefore, by putting your name and address fields into a separate frame, the space occupied by the name field can collapse despite being aligned horizontally with the static text. I have modified your code snippet to demonstrate this:
<frame>
<reportElement key="frame-462" positionType="Float" mode="Transparent" x="0" y="50" width="390" height="70"/>
<frame>
<reportElement x="126" y="0" width="264" height="70"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now">
<reportElement key="textField-844" positionType="Float" mode="Transparent" x="0" y="3" width="264" height="23" isPrintWhenDetailOverflows="true" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[(!$F{firstName}.isEmpty() && !$F{lastName}.isEmpty())]]></printWhenExpression>
</reportElement>
<textElement markup="styled">
<font fontName="Verdana" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{firstName} + "<style pdfFontName='Helvetica-Oblique' size='11'>" + $F{lastName} + "</style>"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now">
<reportElement key="textField-843" mode="Transparent" positionType="Float" x="0" y="26" width="264" height="42" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>
<textElement markup="html">
<font fontName="Verdana" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
</frame>
<staticText>
<reportElement key="staticText-1249" positionType="Float" x="2" y="2" width="108" height="21" isRemoveLineWhenBlank="true"/>
<textElement textAlignment="Left">
<font fontName="Verdana" size="12" isBold="false" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[ Address:]]></text>
</staticText>
</frame>