2016-11-04 3 views
-1

私は、国のロケールごとに日付と数字を表示する必要があるクロスタブを持っています。私はテキスト表現を使用する必要があることを理解していますが、私はどのようにパラメータを使用しなければならないのか理解できません。ロケールはすべての国で「en-IN」(インド向け)、「de-DE」(ドイツ向け)などの形で提供されています。日付と数字の形式は、ログインしているユーザーのロケールに応じて変更する必要があります。ジャスパー報告 - ユーザーのロケールごとに日付と番号のパターンを変更

パラメータでユーザーロケールを取得できました。しかし、私はクロス集計でそれを使う方法を知らない。

PFB jrxml。私は通常の日付と番号の形式は、Javaエンジンによって行われているのでそれが、実際には奇妙な問題だ事前 で

<?xml version="1.0" encoding="UTF-8"?> 
<!-- Created with Jaspersoft Studio version 6.1.0.final using JasperReports Library version 6.1.0 --> 
<!-- 2016-11-04T12:23:19 --> 
<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="crosstabmeasure" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e47b3f7d-1e00-4702-a900-be50a229f085"> 
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="mysql251"/> 
    <import value="org.apache.commons.lang3.time.*"/> 
    <style name="Crosstab_CH" 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="Crosstab_CG" mode="Opaque" backcolor="#BFE1FF"> 
     <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="Crosstab_CT" mode="Opaque" backcolor="#005FB3"> 
     <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="Crosstab_CD" 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="set1" uuid="0271cb46-f184-47b2-8ab3-e6ee96ea33ef"> 
     <property name="com.jaspersoft.studio.data.defaultdataadapter" value="mysql251"/> 
     <parameter name="Locale" class="java.lang.String"> 
      <defaultValueExpression><![CDATA["en-IN"]]></defaultValueExpression> 
     </parameter> 
     <parameter name="UtcOffSet" class="java.lang.Integer"> 
      <defaultValueExpression><![CDATA[330]]></defaultValueExpression> 
     </parameter> 
     <queryString> 
      <![CDATA[select * from internatioinlization]]> 
     </queryString> 
     <field name="col1" class="java.lang.String"> 
      <fieldDescription><![CDATA[]]></fieldDescription> 
     </field> 
     <field name="col2" class="java.lang.Integer"> 
      <fieldDescription><![CDATA[]]></fieldDescription> 
     </field> 
     <field name="col3" class="java.sql.Timestamp"> 
      <fieldDescription><![CDATA[]]></fieldDescription> 
     </field> 
     <field name="col4" class="java.lang.String"> 
      <fieldDescription><![CDATA[]]></fieldDescription> 
     </field> 
    </subDataset> 
    <parameter name="Locale" class="java.lang.String"> 
     <defaultValueExpression><![CDATA["en-IN"]]></defaultValueExpression> 
    </parameter> 
    <parameter name="UtcOffSet" class="java.lang.Integer"> 
     <defaultValueExpression><![CDATA["fi-FI"]]></defaultValueExpression> 
    </parameter> 
    <queryString> 
     <![CDATA[select * from internatioinlization]]> 
    </queryString> 
    <field name="col1" class="java.lang.String"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="col2" class="java.lang.Integer"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="col3" class="java.sql.Timestamp"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="col4" class="java.lang.String"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <summary> 
     <band height="211" splitType="Stretch"> 
      <crosstab> 
       <reportElement x="0" y="0" width="555" height="211" uuid="6c5ccb8a-50fc-4158-b2ba-88d864aa1e43"/> 
       <crosstabParameter name="Parameter1"/> 
       <crosstabParameter name="Parameter2" class="java.lang.Integer"/> 
       <crosstabDataset> 
        <dataset> 
         <datasetRun subDataset="set1" uuid="d255c9b9-fbb2-420a-8ef5-3236098654f1"> 
          <datasetParameter name="Locale"> 
           <datasetParameterExpression><![CDATA[$P{Locale}]]></datasetParameterExpression> 
          </datasetParameter> 
          <datasetParameter name="UtcOffSet"> 
           <datasetParameterExpression><![CDATA[$P{UtcOffSet}]]></datasetParameterExpression> 
          </datasetParameter> 
          <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> 
         </datasetRun> 
        </dataset> 
       </crosstabDataset> 
       <rowGroup name="col11" width="60"> 
        <bucket class="java.lang.String"> 
         <bucketExpression><![CDATA[$F{col1}]]></bucketExpression> 
        </bucket> 
        <crosstabRowHeader> 
         <cellContents mode="Opaque" style="Crosstab_CH"> 
          <textField> 
           <reportElement x="0" y="0" width="60" height="20" uuid="86c09a7f-46b5-4d2f-ba87-715f99d832a8"/> 
           <textFieldExpression><![CDATA[$V{col11}]]></textFieldExpression> 
          </textField> 
         </cellContents> 
        </crosstabRowHeader> 
        <crosstabTotalRowHeader> 
         <cellContents> 
          <staticText> 
           <reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="94fca0ea-1572-4d42-85d9-b06f92c73b6e"/> 
           <text><![CDATA[Total col11]]></text> 
          </staticText> 
         </cellContents> 
        </crosstabTotalRowHeader> 
       </rowGroup> 
       <columnGroup name="col41" height="20"> 
        <bucket class="java.lang.String"> 
         <bucketExpression><![CDATA[$F{col4}]]></bucketExpression> 
        </bucket> 
        <crosstabColumnHeader> 
         <cellContents mode="Opaque" style="Crosstab_CH"> 
          <property name="com.jaspersoft.studio.unit.width" value="pixel"/> 
          <textField> 
           <reportElement x="0" y="0" width="120" height="20" uuid="137ef406-6a2e-4629-9d38-4858c4a5ae2c"> 
            <property name="com.jaspersoft.studio.unit.width" value="pixel"/> 
           </reportElement> 
           <textFieldExpression><![CDATA[$V{col41}]]></textFieldExpression> 
          </textField> 
         </cellContents> 
        </crosstabColumnHeader> 
        <crosstabTotalColumnHeader> 
         <cellContents> 
          <staticText> 
           <reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="5c71211d-f1db-4911-8923-2bdb208ddb99"/> 
           <text><![CDATA[Total col41]]></text> 
          </staticText> 
         </cellContents> 
        </crosstabTotalColumnHeader> 
       </columnGroup> 
       <measure name="col2_MEASURE1" class="java.lang.Integer"> 
        <measureExpression><![CDATA[$F{col2}]]></measureExpression> 
       </measure> 
       <measure name="col3_MEASURE1" class="java.util.Date"> 
        <measureExpression><![CDATA[$F{col3}]]></measureExpression> 
       </measure> 
       <crosstabCell width="120" height="20"> 
        <cellContents mode="Opaque" style="Crosstab_CD"> 
         <textField> 
          <reportElement x="0" y="0" width="60" height="20" uuid="861d0d3a-d774-4b0c-ae7d-ace315bf305c"/> 
          <textFieldExpression><![CDATA[$V{col2_MEASURE1}]]></textFieldExpression> 
         </textField> 
         <textField> 
          <reportElement x="60" y="0" width="60" height="20" uuid="163ed502-e753-444a-942d-832d84da0a5f"> 
           <property name="com.jaspersoft.studio.unit.y" value="pixel"/> 
           <property name="com.jaspersoft.studio.unit.x" value="pixel"/> 
           <property name="com.jaspersoft.studio.unit.height" value="pixel"/> 
          </reportElement> 
          <textFieldExpression><![CDATA[$V{col3_MEASURE1} != null ? DateFormat.getDateInstance(DateFormat.SHORT, new Locale($P{Parameter1}.split("-")[0], $P{Parameter1}.split("-")[1])).format(DateUtils.addMinutes($V{col3_MEASURE1},$P{Parameter2})) : null]]></textFieldExpression> 
         </textField> 
        </cellContents> 
       </crosstabCell> 
       <crosstabCell width="60" height="20" columnTotalGroup="col41"> 
        <cellContents mode="Opaque" style="Crosstab_CT"> 
         <textField> 
          <reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="2576b9e2-3bba-40e3-aa15-5f4f0aada549"/> 
          <textFieldExpression><![CDATA[$V{col2_MEASURE1}]]></textFieldExpression> 
         </textField> 
         <textField> 
          <reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="a111181f-b60f-4afd-8292-9e260c1b9ce2"/> 
          <textFieldExpression><![CDATA[$V{col3_MEASURE1}]]></textFieldExpression> 
         </textField> 
        </cellContents> 
       </crosstabCell> 
       <crosstabCell width="60" height="20" rowTotalGroup="col11"> 
        <cellContents mode="Opaque" style="Crosstab_CT"> 
         <textField> 
          <reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="9adf6c9c-acee-4673-8b70-a376e7d1cbb4"/> 
          <textFieldExpression><![CDATA[$V{col2_MEASURE1}]]></textFieldExpression> 
         </textField> 
         <textField> 
          <reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="9baedeed-4770-4153-b639-afc0965e9467"/> 
          <textFieldExpression><![CDATA[$V{col3_MEASURE1}]]></textFieldExpression> 
         </textField> 
        </cellContents> 
       </crosstabCell> 
       <crosstabCell width="60" height="20" rowTotalGroup="col11" columnTotalGroup="col41"> 
        <cellContents mode="Opaque" style="Crosstab_CT"> 
         <textField> 
          <reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="a2805e0a-080d-42be-ad86-a7e8e666f571"/> 
          <textFieldExpression><![CDATA[$V{col2_MEASURE1}]]></textFieldExpression> 
         </textField> 
         <textField> 
          <reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="c485f69d-91e1-4b19-a8ab-bdbfa3cafcc6"/> 
          <textFieldExpression><![CDATA[$V{col3_MEASURE1}]]></textFieldExpression> 
         </textField> 
        </cellContents> 
       </crosstabCell> 
      </crosstab> 
     </band> 
    </summary> 
</jasperReport> 

おかげRathi

+0

こんにちはすべて、上記の問題を解決するためのアイデアですか? –

答えて

0

のMhを、見つからないエラー発現IDを取得しておきます。

リソースバンドルを作成し、pattern.date = DD.MM.YYYYを追加することができます。 日付テキストフィールドでは、パターン式を$R{pattern.date}に変更するだけです。

関連する問題