2014-07-15 1 views
0

CSV 형식으로 변환 할 XML이 있습니다. Jasper Reports를 사용하여 변환하고 Jasper Studio를 사용하여 JRXML을 디자인했습니다.Jasper Studio의 기본 보고서에 하위 보고서 추가

        ons(field_type)  ux(field_type) 
    fields_existence field_name control-type page-name control-type page-name 

fields_exitence가 3 (nonMap, UX 두)로 분할되고, <field-type type="ons">에서 속성 :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<menu-compare xmlns:mig="http://www..com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www..com"> 
    <menu-info> 
     <menu type="ons" name="HCOTA"/> 
     <menu type="ux" name="RTACOF"/> 
    </menu-info> 
    <field-details> 
     <fields existence="both"> 
      <field name="taChrgOffMsg.taChrgOffCrit.funcCode"> 
       <field-type type="ons"> 
        <group-name>cota</group-name> 
        <page-name>cotacrit</page-name> 
        <control-type>Combo Box</control-type> 
        <ui-field>funcCode</ui-field> 
        <label>FLT000204</label> 
        <label-desc>Function</label-desc> 
        <mandatory>Y</mandatory> 
       </field-type> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinHidden</control-type> 
        <ui-field>funcCode</ui-field> 
        <section-structure>group1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
      <field name="taChrgOffMsg.taChrgOffCrit.Acct.foracid"> 
       <field-type type="ons"> 
        <group-name>cota</group-name> 
        <page-name>cotacrit</page-name> 
        <control-type>Text Field</control-type> 
        <ui-field>acctId</ui-field> 
        <label>FLT000265</label> 
        <label-desc>A/c. ID</label-desc> 
        <mandatory>Y</mandatory> 
       </field-type> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinAccountId</control-type> 
        <ui-field>acctId$accountId</ui-field> 
        <label>FLT001251</label> 
        <label-desc>A/c. ID</label-desc> 
        <mandatory>Y</mandatory> 
        <section-structure>group1.section1.subSection1.finRow1.finCell1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
     </fields> 
     <fields existence="nonMap"> 
      <field> 
       <field-type type="ons"> 
        <group-name>cota</group-name> 
        <page-name>cotacrit</page-name> 
        <control-type>Desc. Label</control-type> 
        <ui-field>acctCrncy</ui-field> 
        <label></label> 
        <mandatory>N</mandatory> 
       </field-type> 
      </field> 
      <field> 
       <field-type type="ons"> 
        <group-name>cota</group-name> 
        <page-name>cotacrit</page-name> 
        <control-type>Desc. Label</control-type> 
        <ui-field>acctSol</ui-field> 
        <label></label> 
        <mandatory>N</mandatory> 
       </field-type> 
      </field> 
      <field> 
       <field-type type="ons"> 
        <group-name>cota</group-name> 
        <page-name>cotacrit</page-name> 
        <control-type>Desc. Label</control-type> 
        <ui-field>acctName</ui-field> 
        <label></label> 
        <mandatory>N</mandatory> 
       </field-type> 
      </field> 
      <field> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinAccountId</control-type> 
        <ui-field>acctId</ui-field> 
        <label>FLT001251</label> 
        <label-desc>A/c. ID</label-desc> 
        <mandatory>Y</mandatory> 
        <section-structure>group1.section1.subSection1.finRow1.finCell1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
      <field> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinHidden</control-type> 
        <ui-field>funcCodeExp</ui-field> 
        <section-structure>group1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
      <field> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinHidden</control-type> 
        <ui-field>hchrgeOffAmt</ui-field> 
        <section-structure>group1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
     </fields> 
     <fields existence="ux"> 
      <field name="taChrgOffMsg.taChrgOffCrit.Acct.acctName"> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinAccountId</control-type> 
        <ui-field>acctId$accountNameDesc</ui-field> 
        <label>FLT001251</label> 
        <label-desc>A/c. ID</label-desc> 
        <mandatory>Y</mandatory> 
        <section-structure>group1.section1.subSection1.finRow1.finCell1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
      <field name="taChrgOffMsg.taChrgOffCrit.Acct.crncyCode"> 
       <field-type type="ux"> 
        <group-name>Rtacof</group-name> 
        <page-name>Rtacof_criteria_form</page-name> 
        <page-name-desc>Transaction A/c. Details</page-name-desc> 
        <control-type>FinAccountId</control-type> 
        <ui-field>acctId$currencyDesc</ui-field> 
        <label>FLT001251</label> 
        <label-desc>A/c. ID</label-desc> 
        <mandatory>Y</mandatory> 
        <section-structure>group1.section1.subSection1.finRow1.finCell1</section-structure> 
        <form>criteria</form> 
       </field-type> 
      </field> 
     </fields> 
    </field-details> 
</menu-compare> 

내가 아래에 열이있는 CSV 형식을 원하는 :

은 XML이다 병합 된 셀 아래에 떨어질 필요가있는 경우, <field-type type="ux">은 위와 같이 병합 된 셀 'ux'에 속해야합니다.

그래서 메인 보고서는 fields_existencefield_name이고 'ons'및 'ux'는 2 개의 하위 보고서가 있습니다.

주 보고서 :

<?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="New3" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7eade40b-45a9-4626-bef7-fbcc2d4397a4"> 
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (5)"/> 
    <subDataset name="Dataset1" uuid="5c92bcef-d33d-481e-afaa-02aa04792e45"> 
     <queryString> 
      <![CDATA[]]> 
     </queryString> 
     <field name="field_name" class="java.lang.String"> 
      <fieldDescription><![CDATA[@name]]></fieldDescription> 
     </field> 
     <field name="control-type-ons" class="java.lang.String"> 
      <fieldDescription><![CDATA[/fields/field/field-type[@type = "ons"]/control-type]]></fieldDescription> 
     </field> 
     <field name="control-type-ux" class="java.lang.String"> 
      <fieldDescription><![CDATA[/fields/field/field-type[@type = "ux"]/control-type]]></fieldDescription> 
     </field> 
     <field name="control-typee-ons" class="java.lang.String"> 
      <fieldDescription><![CDATA[control-type]]></fieldDescription> 
     </field> 
     <field name="control-typee-ux" class="java.lang.String"> 
      <fieldDescription><![CDATA[/fields/field/field-type[@type = "ux"]/control-type]]></fieldDescription> 
     </field> 
     <field name="label-desc-ons" class="java.lang.String"> 
      <fieldDescription><![CDATA[/fields/field/field-type[@type = "ons"]/label-desc]]></fieldDescription> 
     </field> 
    </subDataset> 
    <subDataset name="Dataset2" uuid="f8c00177-6263-49fc-b17d-f307080a8539"> 
     <queryString> 
      <![CDATA[]]> 
     </queryString> 
     <field name="control-type_d2_ons" class="java.lang.String"> 
      <fieldDescription><![CDATA[control-type]]></fieldDescription> 
     </field> 
    </subDataset> 
    <queryString language="XPath"> 
     <![CDATA[/menu-compare/field-details/fields]]> 
    </queryString> 
    <field name="fields_exists" class="java.lang.String"> 
     <fieldDescription><![CDATA[@existence]]></fieldDescription> 
    </field> 
    <field name="field" class="java.lang.String"> 
     <fieldDescription><![CDATA[field]]></fieldDescription> 
    </field> 
    <field name="field_1" class="java.lang.String"> 
     <fieldDescription><![CDATA[field]]></fieldDescription> 
    </field> 
    <field name="field_2" class="java.lang.String"> 
     <fieldDescription><![CDATA[field]]></fieldDescription> 
    </field> 
    <field name="field_3" class="java.lang.String"> 
     <fieldDescription><![CDATA[field]]></fieldDescription> 
    </field> 
    <field name="field_4" class="java.lang.String"> 
     <fieldDescription><![CDATA[field]]></fieldDescription> 
    </field> 
    <field name="field_5" class="java.lang.String"> 
     <fieldDescription><![CDATA[field]]></fieldDescription> 
    </field> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <title> 
     <band height="79" splitType="Stretch"/> 
    </title> 
    <pageHeader> 
     <band height="35" splitType="Stretch"/> 
    </pageHeader> 
    <columnHeader> 
     <band height="73" splitType="Stretch"> 
      <textField> 
       <reportElement uuid="a7807abf-6697-4dbb-b990-f4a63572c158" x="10" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["Map_Type"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="fe9d6fa6-30c2-4507-867a-f60d872a4002" x="110" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["Field-Name"]]></textFieldExpression> 
      </textField> 
     </band> 
    </columnHeader> 
    <detail> 
     <band height="264" splitType="Stretch"> 
      <textField> 
       <reportElement uuid="3f1e6c53-cb80-4117-9aeb-c5b26b1169c0" x="10" y="10" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{fields_exists}]]></textFieldExpression> 
      </textField> 
      <componentElement> 
       <reportElement uuid="e888d323-d870-4c8d-9826-2930dbafcaa4" x="100" y="10" width="310" height="60"/> 
       <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="Dataset1" uuid="fba9150e-05b0-4c8d-933f-26e4766a1de4"> 
         <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("/fields/field")]]></dataSourceExpression> 
        </datasetRun> 
        <jr:listContents height="66" width="310"> 
         <textField> 
          <reportElement uuid="6fb1b0ce-65f2-4c22-aa27-f4083bb535c2" x="10" y="15" width="70" height="30"/> 
          <textElement/> 
          <textFieldExpression><![CDATA[$F{field_name}]]></textFieldExpression> 
         </textField> 
         <textField> 
          <reportElement uuid="c1821c08-9cdd-4ab2-81d1-6e7981f755fe" x="100" y="15" width="70" height="30"/> 
          <textElement/> 
          <textFieldExpression><![CDATA[$F{control-type-ons}]]></textFieldExpression> 
         </textField> 
         <textField> 
          <reportElement uuid="c5cd28df-0742-4f4b-ae5d-1098b472b5a0" x="200" y="15" width="70" height="30"/> 
          <textElement/> 
          <textFieldExpression><![CDATA[$F{control-type-ux}]]></textFieldExpression> 
         </textField> 
        </jr:listContents> 
       </jr:list> 
      </componentElement> 
      <subreport> 
       <reportElement uuid="e57583f2-7163-4c8b-8245-7586cf22491f" x="440" y="20" width="41" height="46"/> 
       <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("/fields/field/field-type")]]></dataSourceExpression> 
       <subreportExpression><![CDATA["New3_SubReport_Ons.jasper"]]></subreportExpression> 
      </subreport> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="45" splitType="Stretch"/> 
    </columnFooter> 
    <pageFooter> 
     <band height="54" splitType="Stretch"/> 
    </pageFooter> 
    <summary> 
     <band height="42" splitType="Stretch"/> 
    </summary> 
</jasperReport> 

SubReport_ONS : 여기 내가 채워집니다 아래에 나열된 모든 필드 속성, 적절하게 데이터를 얻을. 그러나 주 보고서에 추가하면 아무것도 채워지지 않습니다.

<?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="New3_SubReport_Ons" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7d9c4551-de86-4504-9dc0-b7617a01f620"> 
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (5)"/> 
    <queryString language="xPath"> 
     <![CDATA[/menu-compare/field-details/fields/field/field-type[@type = "ons"]]]> 
    </queryString> 
    <field name="group-name" class="java.lang.String"> 
     <fieldDescription><![CDATA[group-name]]></fieldDescription> 
    </field> 
    <field name="page-name" class="java.lang.String"> 
     <fieldDescription><![CDATA[page-name]]></fieldDescription> 
    </field> 
    <field name="control-type" class="java.lang.String"> 
     <fieldDescription><![CDATA[control-type]]></fieldDescription> 
    </field> 
    <field name="ui-field" class="java.lang.String"> 
     <fieldDescription><![CDATA[ui-field]]></fieldDescription> 
    </field> 
    <field name="label" class="java.lang.String"> 
     <fieldDescription><![CDATA[label]]></fieldDescription> 
    </field> 
    <field name="label-desc" class="java.lang.String"> 
     <fieldDescription><![CDATA[label-desc]]></fieldDescription> 
    </field> 
    <field name="mandatory" class="java.lang.String"> 
     <fieldDescription><![CDATA[mandatory]]></fieldDescription> 
    </field> 
    <field name="section-structure" class="java.lang.String"> 
     <fieldDescription><![CDATA[section-structure]]></fieldDescription> 
    </field> 
    <field name="form" class="java.lang.String"> 
     <fieldDescription><![CDATA[form]]></fieldDescription> 
    </field> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <columnHeader> 
     <band height="74" splitType="Stretch"> 
      <textField> 
       <reportElement uuid="11e36190-331d-492d-b2f8-b6b5e255ad29" x="0" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["control-type"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="d29aaacd-1eb0-4f18-800f-79745afaab6a" x="80" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["label-desc"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="975c7937-8450-4270-a14c-f04906402a8a" x="160" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["label"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="29fd8188-114b-4731-8b44-e1b8b87b5734" x="242" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["ui-field"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="8f51cdc4-c1ce-4337-ab61-f4d43d4646bc" x="320" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["group-name"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="7f31617e-3683-4693-a248-6bebe0f5bdf5" x="400" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["page-name"]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="24846d3e-7179-4fc7-91e2-f087b35676ac" x="490" y="30" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA["mandatory"]]></textFieldExpression> 
      </textField> 
     </band> 
    </columnHeader> 
    <detail> 
     <band height="125" splitType="Stretch"> 
      <textField> 
       <reportElement uuid="24c09848-f19d-4954-94d9-f6b1cb95f968" x="0" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{control-type}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="ab6c2cb7-8591-46e4-900e-4b60e0f08f21" x="80" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{label-desc}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="ab1ff84a-23b9-44c1-88a6-1c5a9fffaeb5" x="160" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{label}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="acfb12b3-d8e0-4319-9339-182ac90a5e8b" x="242" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{ui-field}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="1e0c29fd-e910-40dc-b67b-57aabcf96726" x="320" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{group-name}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="f37a62d2-2dfe-4f97-b60e-6fc2cf7e868c" x="400" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{page-name}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="084363d8-635f-4d8b-b0d2-01dbca4ff39f" x="490" y="20" width="70" height="30"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{mandatory}]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 
</jasperReport> 
+0

문제는 고전적입니다. 더 나은 검색을 수행 했어야합니다. 여기에서 답변을 찾을 수 있습니다. http://stackoverflow.com/questions/5258307/blank-pdf-even-with-the-simplest-jasperreport-jrxml/5334415#5334415 –

답변

0

시도가 다음 주 보고서를 실행 JasperReports를 서버에 보고서를 게시하는 .... 주요 아이디어는 우리에게 보고서의 정확한 실행을 포기하지 않았다 재스퍼 스튜디오, 몇 가지 주제를 구현하고 실행해야합니다 JasperReports 서버에서 우리 작업의 성공 여부를 확인하십시오 ... 나는 그것이 당신을 도왔기를 바랍니다.

관련 문제