2017-07-18 111 views
-1

开发IDE:的JasperSoft工作室在贾斯珀表使用主报表数据报告使用

我试图通过使用下面的表达式中使用的数据集表主报表数据源,但我没有得到任何数据。

请告知如何将数据源从报告传递到表格。我是碧玉报告的新手。样本会有帮助。

JRXML:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- Created with Jaspersoft Studio version 6.2.1.final using JasperReports Library version 6.2.1 --> 
<!-- 2017-07-18T10:42:15 --> 
<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_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="62118ef8-810f-4b01-a13c-46539c328b0e"> 
     <property name="com.jaspersoft.studio.data.defaultdataadapter" value="LendingTrustFee1_3_Json"/> 
     <style name="Title" fontName="Arial Unicode MS" fontSize="14"/> 
     <style name="SubTitle" forecolor="#736343" fontName="Arial Unicode MS" fontSize="11"/> 
     <style name="Column header" forecolor="#666666" fontName="Arial Unicode MS" fontSize="11"/> 
     <style name="Detail" fontName="Arial Unicode MS" fontSize="11" pdfEncoding="Identity-H"/> 
     <style name="Table_TH" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table_CH" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table 1_TH" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table 2_TH" mode="Opaque" backcolor="#F0F8FF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table 3_TH" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table 3_CH" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="Table 3_TD" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
       <pen lineWidth="0.5" lineColor="#000000"/> 
       <topPen lineWidth="0.5" lineColor="#000000"/> 
       <leftPen lineWidth="0.5" lineColor="#000000"/> 
       <bottomPen lineWidth="0.5" lineColor="#000000"/> 
       <rightPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <subDataset name="TableDataset" uuid="b931bf1c-7487-4583-8af0-254967fef65f"> 
      <queryString language="csv"> 
       <![CDATA[]]> 
      </queryString> 
      <field name="ClientAndBenificiary" class="java.lang.String"> 
       <fieldDescription><![CDATA[ClientAndBenificiary]]></fieldDescription> 
      </field> 
      <field name="DepartmentNameOfLender" class="java.lang.String"> 
       <fieldDescription><![CDATA[DepartmentNameOfLender]]></fieldDescription> 
      </field> 
      <field name="TrustNoJapanese" class="java.lang.String"> 
       <fieldDescription><![CDATA[TrustNoJapanese]]></fieldDescription> 
      </field> 
      <field name="ContractSignDate" class="java.sql.Date"> 
       <fieldDescription><![CDATA[ContractSignDate]]></fieldDescription> 
      </field> 
      <field name="TrustNo" class="java.lang.String"> 
       <fieldDescription><![CDATA[TrustNo]]></fieldDescription> 
      </field> 
      <field name="ReportStartDate" class="java.sql.Date"> 
       <fieldDescription><![CDATA[ReportStartDate]]></fieldDescription> 
      </field> 
      <field name="EndStartDate" class="java.sql.Date"> 
       <fieldDescription><![CDATA[EndStartDate]]></fieldDescription> 
      </field> 
      <field name="ReportPeriod" class="java.lang.String"> 
       <fieldDescription><![CDATA[ReportPeriod]]></fieldDescription> 
      </field> 
      <field name="Currency" class="java.lang.String"> 
       <fieldDescription><![CDATA[Currency]]></fieldDescription> 
      </field> 
      <field name="ShowLoanValue" class="java.lang.Boolean"> 
       <fieldDescription><![CDATA[ShowLoanValue]]></fieldDescription> 
      </field> 
      <field name="ShowCleanPrice" class="java.lang.Boolean"> 
       <fieldDescription><![CDATA[ShowCleanPrice]]></fieldDescription> 
      </field> 
      <field name="ShowAccruedInt" class="java.lang.Boolean"> 
       <fieldDescription><![CDATA[ShowAccruedInt]]></fieldDescription> 
      </field> 
      <field name="ShowDirtyPrice" class="java.lang.Boolean"> 
       <fieldDescription><![CDATA[ShowDirtyPrice]]></fieldDescription> 
      </field> 
      <field name="UDF1" class="java.lang.String"> 
       <fieldDescription><![CDATA[UDF1]]></fieldDescription> 
      </field> 
      <field name="UDF2" class="java.lang.String"> 
       <fieldDescription><![CDATA[UDF2]]></fieldDescription> 
      </field> 
      <field name="ReportFrequency" class="java.lang.String"> 
       <fieldDescription><![CDATA[ReportFrequency]]></fieldDescription> 
      </field> 
      <field name="QtrReportStartDate" class="java.sql.Date"> 
       <fieldDescription><![CDATA[QtrReportStartDate]]></fieldDescription> 
      </field> 
      <field name="QtrReportEndDate" class="java.sql.Date"> 
       <fieldDescription><![CDATA[QtrReportEndDate]]></fieldDescription> 
      </field> 
      <field name="Securities_No_Mon1_3" class="java.lang.String"> 
       <fieldDescription><![CDATA[Securities_No_Mon1_3]]></fieldDescription> 
      </field> 
      <field name="Lending_Fee_Mon1_3" class="java.math.BigDecimal"> 
       <fieldDescription><![CDATA[Lending_Fee_Mon1_3]]></fieldDescription> 
      </field> 
      <field name="Trust_Fee_Mon1_3" class="java.math.BigDecimal"> 
       <fieldDescription><![CDATA[Trust_Fee_Mon1_3]]></fieldDescription> 
      </field> 
      <field name="Consumption_Tax_Mon1_3" class="java.math.BigDecimal"> 
       <fieldDescription><![CDATA[Consumption_Tax_Mon1_3]]></fieldDescription> 
      </field> 
      <field name="Trust_Fee_Tax_Included_Mon1_3" class="java.math.BigDecimal"> 
       <fieldDescription><![CDATA[Trust_Fee_Tax_Included_Mon1_3]]></fieldDescription> 
      </field> 
      <field name="SectionType" class="java.lang.String"> 
       <fieldDescription><![CDATA[SectionType]]></fieldDescription> 
      </field> 
      <filterExpression><![CDATA[LEN($F{Securities_No_Mon1_3}) > 0]]></filterExpression> 
     </subDataset> 
     <queryString> 
      <![CDATA[]]> 
     </queryString> 
     <background> 
      <band splitType="Stretch"/> 
     </background> 
     <detail> 
      <band height="322" splitType="Stretch"> 
       <componentElement> 
        <reportElement x="-1" y="0" width="551" height="220" uuid="3aaf3c11-1464-432e-a55d-fef0a54cfdaa"> 
         <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> 
         <property name="com.jaspersoft.studio.table.style.table_header" value="Table 3_TH"/> 
         <property name="com.jaspersoft.studio.table.style.column_header" value="Table 3_CH"/> 
         <property name="com.jaspersoft.studio.table.style.detail" value="Table 3_TD"/> 
        </reportElement> 
        <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> 
         <datasetRun subDataset="TableDataset" uuid="75b0fbb9-805b-4e97-86e2-9a2688aae1ff"> 
          <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> 
         </datasetRun> 
         <jr:column width="90" uuid="21ee4add-5a78-4c46-8ae3-1da6c6759a19"> 
          <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/> 
          <jr:detailCell style="Table 3_TD" height="30"> 
           <textField> 
            <reportElement style="Detail" positionType="Float" x="0" y="0" width="90" height="30" uuid="575908d3-6ea1-4a84-a95c-985941866a21"/> 
            <box> 
             <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
            </box> 
            <textElement textAlignment="Center" verticalAlignment="Middle"/> 
            <textFieldExpression><![CDATA[$F{Securities_No_Mon1_3}]]></textFieldExpression> 
           </textField> 
          </jr:detailCell> 
         </jr:column> 
         <jr:column width="90" uuid="b5f25971-4c63-4094-ab6a-102adb70593e"> 
          <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/> 
          <jr:detailCell style="Table 3_TD" height="30"> 
           <textField> 
            <reportElement style="Detail" positionType="Float" x="0" y="0" width="90" height="30" uuid="aa37293c-1ffc-48d3-a3f2-32abc83ebcb8"/> 
            <box> 
             <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
            </box> 
            <textElement textAlignment="Right" verticalAlignment="Middle"/> 
            <textFieldExpression><![CDATA[$F{Lending_Fee_Mon1_3}]]></textFieldExpression> 
           </textField> 
          </jr:detailCell> 
         </jr:column> 
         <jr:column width="80" uuid="96b8c9f2-b20f-4850-8702-aa4935cd496f"> 
          <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/> 
          <jr:detailCell style="Table 3_TD" height="30"> 
           <textField> 
            <reportElement style="Detail" positionType="Float" x="0" y="0" width="80" height="30" uuid="0c059aad-8bf2-45c7-854f-c26bcdcbcb72"/> 
            <box> 
             <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
            </box> 
            <textElement textAlignment="Right" verticalAlignment="Middle"/> 
            <textFieldExpression><![CDATA[$F{Trust_Fee_Mon1_3}]]></textFieldExpression> 
           </textField> 
          </jr:detailCell> 
         </jr:column> 
         <jr:column width="70" uuid="4c69cb0c-bcd8-46a5-9ccc-f284fa037f14"> 
          <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/> 
          <jr:detailCell style="Table 3_TD" height="30"> 
           <textField> 
            <reportElement style="Detail" positionType="Float" x="0" y="0" width="70" height="30" uuid="89d56faf-0773-4b1b-9229-08e2322e7650"/> 
            <box> 
             <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
            </box> 
            <textElement textAlignment="Right" verticalAlignment="Middle"/> 
            <textFieldExpression><![CDATA[$F{Consumption_Tax_Mon1_3}]]></textFieldExpression> 
           </textField> 
          </jr:detailCell> 
         </jr:column> 
         <jr:column width="170" uuid="1ff92af5-e2c2-4ab9-864a-73496dec702d"> 
          <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/> 
          <jr:detailCell style="Table 3_TD" height="30"> 
           <textField> 
            <reportElement style="Detail" positionType="Float" x="0" y="0" width="170" height="30" uuid="1ecb2036-49d9-4337-b1de-2aa660e15bd6"/> 
            <box> 
             <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
             <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> 
            </box> 
            <textElement textAlignment="Right" verticalAlignment="Middle"/> 
            <textFieldExpression><![CDATA[$F{Trust_Fee_Tax_Included_Mon1_3}]]></textFieldExpression> 
           </textField> 
          </jr:detailCell> 
         </jr:column> 
        </jr:table> 
       </componentElement> 
      </band> 
     </detail> 
    </jasperReport> 

JSON数据:

[{"sectionType":"A","ClientAndBenificiary":"全国共済水産業協同組合連合会","DepartmentNameOfLender":"財務運用部 御中","TrustNoJapanese":"6018","ContractSignDate":"2013-04-23","TrustNo":"6018","ReportStartDate":"2016-07-01","EndStartDate":"2016-07-31","ReportPeriod":"2016-07-01から2016-07-31まで","Currency":"円","ShowLoanValue":"0","ShowCleanPrice":"0","ShowAccruedInt":"0","ShowDirtyPrice":"0","UDF1":"0.08","UDF2":"","ReportFrequency":"","QtrReportStartDate":"2016-07-01","QtrReportEndDate":"2016-08-01","Securities_No_Mon1_3":"JGB #289(10)Total","Lending_Fee_Mon1_3":"523645.000000000","Trust_Fee_Mon1_3":"174537.000000000","Consumption_Tax_Mon1_3":"13950.000000000","Trust_Fee_Tax_Included_Mon1_3":"188487.000000000","ReportLanguage":"ja","SectionType":"A"},{"sectionType":"A","ClientAndBenificiary":"全国共済水産業協同組合連合会","DepartmentNameOfLender":"財務運用部 御中","TrustNoJapanese":"6018","ContractSignDate":"2013-04-23","TrustNo":"6018","ReportStartDate":"2016-07-01","EndStartDate":"2016-07-31","ReportPeriod":"2016-07-01から2016-07-31まで","Currency":"円","ShowLoanValue":"0","ShowCleanPrice":"0","ShowAccruedInt":"0","ShowDirtyPrice":"0","UDF1":"0.08","UDF2":"","ReportFrequency":"","QtrReportStartDate":"2016-07-01","QtrReportEndDate":"2016-08-01","Securities_No_Mon1_3":"JGB #300(10)Total","Lending_Fee_Mon1_3":"268618.000000000","Trust_Fee_Mon1_3":"89529.000000000","Consumption_Tax_Mon1_3":"7148.000000000","Trust_Fee_Tax_Included_Mon1_3":"96677.000000000","ReportLanguage":"ja","SectionType":"A"},{"sectionType":"A","ClientAndBenificiary":"全国共済水産業協同組合連合会","DepartmentNameOfLender":"財務運用部 御中","TrustNoJapanese":"6018","ContractSignDate":"2013-04-23","TrustNo":"6018","ReportStartDate":"2016-07-01","EndStartDate":"2016-07-31","ReportPeriod":"2016-07-01から2016-07-31まで","Currency":"円","ShowLoanValue":"0","ShowCleanPrice":"0","ShowAccruedInt":"0","ShowDirtyPrice":"0","UDF1":"0.08","UDF2":"","ReportFrequency":"","QtrReportStartDate":"2016-07-01","QtrReportEndDate":"2016-08-01","Securities_No_Mon1_3":"JGB #305(10)Total","Lending_Fee_Mon1_3":"538950.000000000","Trust_Fee_Mon1_3":"179641.000000000","Consumption_Tax_Mon1_3":"14354.000000000","Trust_Fee_Tax_Included_Mon1_3":"193995.000000000","ReportLanguage":"ja","SectionType":"A"}] 

我已经加入我试图加载JRXML和JSON。当我在数据集中传递dataSourceExpression时,我只得到2行,但在源数据中有三行。请帮我解决这个问题

回答

0

为了在Jasper的表格组件中显示数据,我们需要设置与主报表数据集不同的新数据集。我们可以在主要报表数据集中编写任何虚拟查询,如'从双选择1';如果数据库是mysql的话。

+0

感谢Shrashti的回复,我添加了一个类似于主数据集的虚拟数据集。我使用Json或CSV作为输入,并且两者都不起作用。 – Somu

+0

我已经添加了我尝试加载的JRXML和Json。当我在数据集中传递dataSourceExpression时,我只得到2行,但在源数据中有三行。请帮我解决这个问题。 – Somu