Jump to content
We've recently updated our Privacy Statement, available here ×

rusindes

Members
  • Posts

    2
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Posts posted by rusindes

  1. I am trying to generate report using Jasper iReport Designer 5.6.0, where is list with table and some textfields. The generated report could look like this:

    CFcF1.png

    To do this, I'm using the following XML file as datasource:

    <report>    <persons>        <person>            <dateOfBirth>1940-02-01T00:00:00.000Z</dateOfBirth>            <fullName>Walter White</fullName>            <address>Albuquerque 87107</address>        </person>        <person>            <dateOfBirth>1989-02-01T00:00:00.000Z</dateOfBirth>            <fullName>Skyler White</fullName>            <address>Albuquerque 87107</address>        </person>        <person>            <dateOfBirth>1962-02-01T00:00:00.000Z</dateOfBirth>            <fullName>Jesse Pinkman</fullName>            <address>Santa Fé 28</address>            <companies>                <company>                    <nameOfCompany>Company 124</nameOfCompany>                    <addressOfCompany>Santa Fé 158</addressOfCompany>                </company>            </companies>        </person>        <person>            <dateOfBirth>1970-02-01T00:00:00.000Z</dateOfBirth>            <fullName>Hank Schrader</fullName>            <address>El Paso 17</address>            <companies>                <company>                    <nameOfCompany>El Paso Company</nameOfCompany>                    <addressOfCompany>El Paso 28</addressOfCompany>                </company>                <company>                    <nameOfCompany>COMPANY EPC</nameOfCompany>                    <addressOfCompany>Santa Fé 18</addressOfCompany>                </company>            </companies>        </person>    </persons></report>[/code]

    And JRXML template:

    <?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="report1_subreport1" pageWidth="756" pageHeight="140"               whenNoDataType="BlankPage" columnWidth="756" leftMargin="0"               rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error"              isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">   <property name="ireport.zoom" value="1.7715610000000022"/>   <property name="ireport.x" value="0"/>   <property name="ireport.y" value="0"/>   <style name="table 3">      <box>         <pen lineWidth="1.0" lineColor="#000000"/>      </box>   </style>   <style name="table 3_TH" mode="Opaque">      <box>         <pen lineWidth="0.0" lineColor="#000000"/>      </box>   </style>   <style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">      <box>         <pen lineWidth="0.5" lineColor="#000000"/>      </box>   </style>   <style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">      <box>         <pen lineWidth="0.5" lineColor="#000000"/>      </box>   </style>   <subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">      <queryString language="xPath">         <![CDATA[/report/persons/person]]>      </queryString>      <field name="dateOfBirth" class="java.lang.String">         <fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>      </field>      <field name="fullName" class="java.lang.String">         <fieldDescription><![CDATA[fullName]]></fieldDescription>      </field>      <field name="address" class="java.lang.String">         <fieldDescription><![CDATA[address]]></fieldDescription>      </field>   </subDataset>   <subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">      <queryString language="xPath">         <![CDATA[/report/persons/person/companies/company]]>      </queryString>      <field name="nameOfCompany" class="java.lang.String">         <fieldDescription><![CDATA[nameOfCompany]]></fieldDescription>      </field>      <field name="addressOfCompany" class="java.lang.String">         <fieldDescription><![CDATA[addressOfCompany]]></fieldDescription>      </field>   </subDataset>   <queryString language="xPath">      <![CDATA[/report]]>   </queryString>   <background>      <band splitType="Stretch"/>   </background>   <detail>      <band height="140" splitType="Stretch">         <componentElement>            <reportElement x="1" y="0" width="753" height="140"                            uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>            <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="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">                  <dataSourceExpression>                     <![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/report/persons/person")]]>                  </dataSourceExpression>               </datasetRun>               <jr:listContents height="140" width="753">                  <staticText>                     <reportElement mode="Opaque" x="0" y="0" width="100" height="13"                                     backcolor="#C0C0C0"                                     uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>                     <box leftPadding="2">                        <topPen lineWidth="0.75"/>                        <leftPen lineWidth="0.75"/>                        <bottomPen lineWidth="0.75"/>                        <rightPen lineWidth="0.75"/>                     </box>                     <textElement verticalAlignment="Middle">                        <font size="8" pdfEncoding="Cp1250"/>                     </textElement>                     <text><![CDATA[Full name]]></text>                  </staticText>                  <staticText>                     <reportElement mode="Opaque" x="0" y="13" width="100" height="13"                                     backcolor="#C0C0C0"                                     uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>                     <box leftPadding="2">                        <topPen lineWidth="0.75"/>                        <leftPen lineWidth="0.75"/>                        <bottomPen lineWidth="0.75"/>                        <rightPen lineWidth="0.75"/>                     </box>                     <textElement verticalAlignment="Middle">                        <font size="8" pdfEncoding="Cp1250"/>                     </textElement>                     <text><![CDATA[Address:]]></text>                  </staticText>                  <staticText>                     <reportElement mode="Opaque" x="0" y="26" width="100" height="13"                                     backcolor="#C0C0C0"                                     uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>                     <box leftPadding="2">                        <topPen lineWidth="0.75"/>                        <leftPen lineWidth="0.75"/>                        <bottomPen lineWidth="0.75"/>                        <rightPen lineWidth="0.75"/>                     </box>                     <textElement verticalAlignment="Middle">                        <font size="8" pdfEncoding="Cp1250"/>                     </textElement>                     <text><![CDATA[Date of birth:]]></text>                  </staticText>                  <textField>                     <reportElement x="101" y="0" width="239" height="13"                                     uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>                     <box leftPadding="2">                        <topPen lineWidth="0.75"/>                        <leftPen lineWidth="0.75"/>                        <bottomPen lineWidth="0.75"/>                        <rightPen lineWidth="0.75"/>                     </box>                     <textElement verticalAlignment="Middle">                        <font size="8" pdfEncoding="Cp1250"/>                     </textElement>                     <textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>                  </textField>                  <textField>                     <reportElement x="101" y="13" width="239" height="13"                                     uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>                     <box leftPadding="2">                        <topPen lineWidth="0.75"/>                        <leftPen lineWidth="0.75"/>                        <bottomPen lineWidth="0.75"/>                        <rightPen lineWidth="0.75"/>                     </box>                     <textElement verticalAlignment="Middle">                        <font size="8" pdfEncoding="Cp1250"/>                     </textElement>                     <textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>                  </textField>                  <textField>                     <reportElement x="101" y="26" width="239" height="13"                                     uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>                     <box leftPadding="2">                        <topPen lineWidth="0.75"/>                        <leftPen lineWidth="0.75"/>                        <bottomPen lineWidth="0.75"/>                        <rightPen lineWidth="0.75"/>                     </box>                     <textElement verticalAlignment="Middle">                        <font size="8" pdfEncoding="Cp1250"/>                     </textElement>                     <textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>                  </textField>                  <componentElement>                     <reportElement key="NajdenaOsobaTable1" style="table 3"                                     stretchType="RelativeToBandHeight" mode="Transparent" x="88" y="56"                                     width="645" height="50" isPrintWhenDetailOverflows="true"                                     uuid="99480409-009b-4f75-b435-ad99403ddb56"/>                     <jr:table whenNoDataType="AllSectionsNoDetail">                        <datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">                           <dataSourceExpression>                               <![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/report/persons/person/companies/company")]]>                           </dataSourceExpression>                        </datasetRun>                        <jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">                           <jr:tableHeader style="table 3_TH" height="17" rowSpan="1">                              <staticText>                                 <reportElement mode="Opaque" x="0" y="0" width="125" height="17"                                                 backcolor="#C0C0C0"                                                 uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>                                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">                                    <pen lineWidth="0.75"/>                                    <topPen lineWidth="0.75"/>                                    <leftPen lineWidth="0.75"/>                                    <bottomPen lineWidth="0.75"/>                                    <rightPen lineWidth="0.75"/>                                 </box>                                 <textElement textAlignment="Center" verticalAlignment="Middle">                                    <font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>                                 </textElement>                                 <text><![CDATA[Name of Company]]></text>                              </staticText>                           </jr:tableHeader>                           <jr:detailCell style="table 3_TD" height="16" rowSpan="1">                              <textField isBlankWhenNull="true">                                 <reportElement x="0" y="0" width="125" height="16"                                                 isPrintWhenDetailOverflows="true"                                                 uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>                                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">                                    <pen lineWidth="0.75"/>                                    <topPen lineWidth="0.75"/>                                    <leftPen lineWidth="0.75"/>                                    <bottomPen lineWidth="0.75"/>                                    <rightPen lineWidth="0.75"/>                                 </box>                                 <textElement textAlignment="Center" verticalAlignment="Middle">                                    <font fontName="Arial" size="8" pdfEncoding="Cp1250"/>                                 </textElement>                                 <textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>                              </textField>                           </jr:detailCell>                        </jr:column>                        <jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">                           <jr:tableHeader style="table 3_TH" height="17" rowSpan="1">                              <staticText>                                 <reportElement mode="Opaque" x="0" y="0" width="160" height="17"                                                 backcolor="#C0C0C0"                                                 uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>                                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">                                    <pen lineWidth="0.75"/>                                    <topPen lineWidth="0.75"/>                                    <leftPen lineWidth="0.75"/>                                    <bottomPen lineWidth="0.75"/>                                    <rightPen lineWidth="0.75"/>                                 </box>                                 <textElement textAlignment="Center" verticalAlignment="Middle">                                    <font fontName="Arial" size="8" pdfEncoding="Cp1250"/>                                 </textElement>                                 <text><![CDATA[Address of Company]]></text>                              </staticText>                           </jr:tableHeader>                           <jr:detailCell style="table 3_TD" height="16" rowSpan="1">                              <textField isBlankWhenNull="true">                                 <reportElement x="0" y="0" width="160" height="16"                                                 isPrintWhenDetailOverflows="true"                                                 uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>                                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">                                    <pen lineWidth="0.75"/>                                    <topPen lineWidth="0.75"/>                                    <leftPen lineWidth="0.75"/>                                    <bottomPen lineWidth="0.75"/>                                    <rightPen lineWidth="0.75"/>                                 </box>                                 <textElement textAlignment="Center" verticalAlignment="Middle">                                    <font fontName="Arial" size="8" pdfEncoding="Cp1250"/>                                 </textElement>                                 <textFieldExpression>                                    <![CDATA[$F{addressOfCompany}]]>                                 </textFieldExpression>                              </textField>                           </jr:detailCell>                        </jr:column>                     </jr:table>                  </componentElement>               </jr:listContents>            </jr:list>         </componentElement>      </band>   </detail></jasperReport>[/code]

    And this is what I'm getting as resulting report:

    1SPDD.png

     

    What can I do? Any ideas? Thank you !

  2. I am trying to create the subreport in the main report only with the static texts.

    Main report:

    YrCcV.pngxml:

    <?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="report1" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f175bd48-f661-425f-a3e1-763996d44ca7">    <property name="ireport.zoom" value="1.3310000000000004"/>    <property name="ireport.x" value="0"/>    <property name="ireport.y" value="0"/>    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">        <defaultValueExpression><![CDATA["C:eclipse_workplaceesd01srcappapp-gendocgendoc-implsrcmainresourcestemplatesjasper"]]></defaultValueExpression>    </parameter>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="79" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="100" height="20" uuid="a0319d8a-68cd-447a-8889-301e0d0139e3"/>                <text><![CDATA[Hello Title]]></text>            </staticText>        </band>    </title>    <detail>        <band height="125" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="100" height="20" uuid="471d80ae-9da4-4944-911a-f90acb8e0e91"/>                <text><![CDATA[Hello Detail]]></text>            </staticText>            <subreport>                <reportElement x="114" y="20" width="641" height="79" uuid="beace73f-401b-4406-a8b4-603a3df43a9e"/>                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "report1_subreport1.jasper"]]></subreportExpression>            </subreport>        </band>    </detail>    <pageFooter>        <band height="54" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="100" height="20" uuid="513068b2-28cf-4d3e-a2f5-fd57d9cdcc3b"/>                <text><![CDATA[Hello Footer]]></text>            </staticText>        </band>    </pageFooter></jasperReport>[/code]

    Subreport:

    WPsBy.png

    xml:

    <?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="report1_subreport1" language="groovy" pageWidth="802" pageHeight="555" orientation="Landscape" columnWidth="802" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="57901f58-6d39-40b8-9972-7f2dfff24f53">    <property name="ireport.zoom" value="1.0"/>    <property name="ireport.x" value="0"/>    <property name="ireport.y" value="0"/>    <detail>        <band height="125" splitType="Stretch">            <staticText>                <reportElement x="325" y="45" width="143" height="35" uuid="6977bf0b-7047-495c-b1e1-af3010a8cd39"/>                <textElement>                    <font size="24"/>                </textElement>                <text>                    <![CDATA[Hello World]]>                </text>            </staticText>        </band>    </detail></jasperReport>[/code]

    Now, when I am trying click to preview button from the main report, the subreport is not displayed. What am I doing wrong?

    Preview from main report:

    XHHBg.png

     

×
×
  • Create New...