Jump to content
JasperReports Library 7.0 is now available ×

Marking file with errors when there is no one


firuzzz

Recommended Posts

Every time I open  JS, it makes this file with errors, if I go to that jrxml and compile it, the errors disappear, but reopening the IDE, the "problem" is back

the problem seems to be this line where the IDE initialy thinks the periodo is a BigDecimal
 

<textFieldExpression><![CDATA[new SimpleDateFormat("MM/yyyy").format(new SimpleDateFormat("yyyyMM").parse($F{periodo}.toString()))]]></textFieldExpression>             </textField>             <textField>[/code]

 

Tab Problems

Errors (3 items)
The method parse(String) in the type DateFormat is not applicable for the arguments (BigDecimal)    OSDeclaracionAnualF931.jrxml    /sindicato/reportes    line 0    JRXML Problem
The method parse(String) in the type DateFormat is not applicable for the arguments (BigDecimal) value = new SimpleDateFormat("MMM").format(new SimpleDateFormat("yyyyMM").parse(((java.math.BigDecimal)field_periodo.getOldValue())));     OSDeclaracionAnualF931.jrxml    /sindicato/reportes    line 0    JRXML Problem
The method parse(String) in the type DateFormat is not applicable for the arguments (BigDecimal) value = new SimpleDateFormat("MMM").format(new SimpleDateFormat("yyyyMM").parse(((java.math.BigDecimal)field_periodo.getValue())));     OSDeclaracionAnualF931.jrxml    /sindicato/reportes    line 0    JRXML Problem

 

This is the file: 

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  --><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="OSDeclaracionAnualF931" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="656860b5-a66f-4d1a-b132-882d4df1c801">    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">        <defaultValueExpression><![CDATA[""]]></defaultValueExpression>    </parameter>    <parameter name="DESDE" class="java.util.Date">        <defaultValueExpression><![CDATA[]]></defaultValueExpression>    </parameter>    <parameter name="HASTA" class="java.util.Date">        <defaultValueExpression><![CDATA[]]></defaultValueExpression>    </parameter>    <queryString>        <![CDATA[select afip.periodo, count(afip.importe) cant , sum(afip.importe) totalfrom nominaos afip, maestroos mos JOIN provincia_zona pz ON mos.provincia_id = pz.provincia_idwhere afip.periodo >=to_char($P{DESDE}::date, 'yyyyMM'::varchar)::int     and afip.periodo <=to_char($P{HASTA}::date, 'yyyyMM'::varchar)::int and afip.zona = pz.zonagroup by afip.periodoorder by afip.periodo]]>    </queryString>    <field name="periodo" class="java.lang.Integer"/>    <field name="cant" class="java.lang.Long"/>    <field name="total" class="java.math.BigDecimal"/>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="79" splitType="Stretch">            <subreport>                <reportElement x="0" y="0" width="555" height="79" uuid="12a56761-7de3-46e6-a4f1-4ec954c8de83"/>                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "membreteOS.jasper"]]></subreportExpression>            </subreport>            <textField pattern="dd/MM/yyyy HH:mm:ss">                <reportElement x="455" y="60" width="100" height="19" uuid="c531d91b-93b1-4c02-b8f6-b18be12e3870"/>                <textElement textAlignment="Right">                    <font size="9"/>                </textElement>                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>            </textField>        </band>    </title>    <pageHeader>        <band height="40" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="555" height="25" uuid="59888f5c-7d45-46e6-abd8-5ca55f7ca1ba"/>                <textElement textAlignment="Center">                    <font size="16" isBold="true"/>                </textElement>                <text><![CDATA[Obra Social: Declaraciones de Remunerativos según F931]]></text>            </staticText>            <staticText>                <reportElement x="341" y="25" width="214" height="15" uuid="0d6c3875-5dea-4eef-9aaf-a81d0d282918"/>                <text><![CDATA[¹ corresponde al 9% menos el FSR (10-15%)]]></text>            </staticText>        </band>    </pageHeader>    <columnHeader>        <band height="20" splitType="Stretch">            <staticText>                <reportElement mode="Opaque" x="0" y="0" width="100" height="20" backcolor="#CCCCCC" uuid="0942c542-9e69-41b0-ae0c-54cd6c655df5"/>                <textElement textAlignment="Center">                    <font size="12" isBold="true"/>                </textElement>                <text><![CDATA[Periodo]]></text>            </staticText>            <staticText>                <reportElement mode="Opaque" x="100" y="0" width="95" height="20" backcolor="#CCCCCC" uuid="08efc0b2-db13-466b-b6be-83185d6b57eb"/>                <textElement textAlignment="Center">                    <font size="12" isBold="true"/>                </textElement>                <text><![CDATA[Cantidad]]></text>            </staticText>            <staticText>                <reportElement mode="Opaque" x="195" y="0" width="120" height="20" backcolor="#CCCCCC" uuid="35423cbb-d1c7-4e87-8429-dc22dcfba212"/>                <textElement textAlignment="Center">                    <font size="12" isBold="true"/>                </textElement>                <text><![CDATA[Total REM]]></text>            </staticText>            <staticText>                <reportElement mode="Opaque" x="315" y="0" width="120" height="20" backcolor="#CCCCCC" uuid="1614b4b5-d465-4002-bfd0-954437748196"/>                <textElement textAlignment="Center">                    <font size="12" isBold="true"/>                </textElement>                <text><![CDATA[OS (9%)]]></text>            </staticText>            <staticText>                <reportElement mode="Opaque" x="435" y="0" width="120" height="20" backcolor="#CCCCCC" uuid="c849695f-3343-4ecd-8bfc-dcd6aac8a718"/>                <textElement textAlignment="Center">                    <font size="12" isBold="true"/>                </textElement>                <text><![CDATA[Distribución¹]]></text>            </staticText>        </band>    </columnHeader>    <detail>        <band height="15" splitType="Stretch">            <textField>                <reportElement x="0" y="0" width="100" height="15" uuid="5f35e64c-b54d-4c3f-955f-6f46ae8248d7"/>                <textElement textAlignment="Left"/>                <textFieldExpression><![CDATA[new SimpleDateFormat("MM/yyyy").format(new SimpleDateFormat("yyyyMM").parse($F{periodo}.toString()))]]></textFieldExpression>            </textField>            <textField>                <reportElement x="100" y="0" width="95" height="15" uuid="98afa13e-e3e0-4a68-97eb-9f7b7840ee72"/>                <box rightPadding="2"/>                <textElement textAlignment="Center"/>                <textFieldExpression><![CDATA[$F{cant}]]></textFieldExpression>            </textField>            <textField pattern="¤#,##0.00;¤-#,##0.00">                <reportElement x="195" y="0" width="120" height="15" uuid="955e7739-9f04-48fc-85a1-ebf574a98b28"/>                <box rightPadding="2"/>                <textElement textAlignment="Right"/>                <textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>            </textField>            <textField pattern="¤#,##0.00;¤-#,##0.00">                <reportElement x="315" y="0" width="120" height="15" uuid="0b4eb0d0-1b94-4e14-b11b-31bf6233a17b"/>                <box rightPadding="2"/>                <textElement textAlignment="Right"/>                <textFieldExpression><![CDATA[$F{total}.multiply(BigDecimal.valueOf(0.09)).setScale(2, RoundingMode.HALF_UP)]]></textFieldExpression>            </textField>            <textField pattern="¤#,##0.00;¤-#,##0.00">                <reportElement x="435" y="0" width="120" height="15" uuid="23151b97-e274-417d-966e-1617b3ec8062"/>                <box rightPadding="2"/>                <textElement textAlignment="Right"/>                <textFieldExpression><![CDATA[$F{total}.multiply(BigDecimal.valueOf(0.09)).multiply(BigDecimal.valueOf(0.85)).setScale(2, RoundingMode.HALF_UP)]]></textFieldExpression>            </textField>        </band>    </detail>    <pageFooter>        <band height="30" splitType="Stretch"/>    </pageFooter>    <summary>        <band height="30" splitType="Stretch"/>    </summary></jasperReport>[/code]
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi firuzzz, 

Are yo usure you have sharing the correct error ? 
The method parse(String) in the type DateFormat is not applicable for the arguments (BigDecimal) value = new SimpleDateFormat("MMM").format(new SimpleDateFormat("yyyyMM").parse(((java.math.BigDecimal)field_periodo.getOldValue())));  

The above expression has a value "MMM" and I cannot find this in the source code you shared ... 
Also this error indicates that periodo was set as bigdecimal type and your source code has periodo set a integer type, which will no generate the error above ? So something is not matching with your error and the source code. Are you refering to date in your title subreport ?  
Also in your detialed band you have 2 textfield where you make use the 2 expressions : 
• $F{total}.multiply(BigDecimal.valueOf(0.09)).setScale(2, RoundingMode.HALF_UP)
• $F{total}.multiply(BigDecimal.valueOf(0.09)).multiply(BigDecimal.valueOf(0.85)).setScale(2, RoundingMode.HALF_UP)

Rather create variable to do this. 
Set class to java.math.BigDecimal ,
Calculation to no calc ,
Expression to your expression. 
Initial Value Exp to new BigDecimal(0) 
Increment Type to None , 
Reset Type to Report. 

Then use the variable in your textfield in the detial band instead of the whole epxresison.

Link to comment
Share on other sites

try changing your query as below and see if it works

select to_char(afip.periodo) periodo, count(afip.importe) cant , sum(afip.importe) totalfrom nominaos afip, maestroos mos JOIN provincia_zona pz ON mos.provincia_id = pz.provincia_idwhere afip.periodo >=to_char($P{DESDE}::date, 'yyyyMM'::varchar)::int     and afip.periodo <=to_char($P{HASTA}::date, 'yyyyMM'::varchar)::int and afip.zona = pz.zonagroup by to_char(afip.periodo)order by to_char(afip.periodo)

Link to comment
Share on other sites

Also this error indicates that periodo was set as bigdecimal type and your source code has periodo set a integer type, 

<field name="periodo" class="java.lang.Integer"/> this is the definition of the field, there is no BigDecimal related to periodo.

You are right about the SimpleDateFormatter("MMM") , there is no such formatter definition in the source yet there are 2 or 3 errors that point to that file when I double click them

 

As I pointed out, the errors disappear after compiling, that means the JS read "better" the jrxml and notice that there is no such error

 

 

@reportdev

Why would I cast it to String/varchar?, the report works fine, there is no need for that workaround, it's just this annoying bug that marks the file with Errors. 

PD: I have a lot of reports with a similar query

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...