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

increase year on editor expression ($F{annee_entree}+"/"+ ($F{annee_entree}))


christmoney1

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I have checked your attachment.
You have defined the field type as 'java.lang.Integer'.
It is indeed strange that your 'expression' does not work.
The reason is that I tried it with a mock expression and it worked as expected.


By the way, what values do you see in the execution result?

 

Link to comment
Share on other sites

Hello 

Thank you for your help.

Yes it's strange that it does not work.

This is the message error when i click on preview button:  "The operator + is undefined for the argument type(s) Integer, int.".

You says that you've tried with a mock expression how can i do that?

Sincerely.

 

 

Link to comment
Share on other sites

The test source for me is as follows.

The first text field is an example of String type.
The second text field is an example of Integer type.
I hope it helps.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 7.5.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb  -->
<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="W20210612_table" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6fda6c7f-be6e-44f5-9943-ed910d06adb9">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="MySQL_44_test"/>
    <queryString language="SQL">
        <![CDATA[select 2020 year_str ,2020 year_int from dual]]>
    </queryString>
    <field name="year_str" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.label" value="year_str"/>
    </field>
    <field name="year_int" class="java.lang.Integer">
        <property name="com.jaspersoft.studio.field.label" value="year_int"/>
    </field>
    <summary>
        <band height="148" splitType="Stretch">
            <textField>
                <reportElement x="0" y="20" width="550" height="30" uuid="d8fba6e4-bc55-4bfc-ba49-f2d9a61282d8"/>
                <textElement>
                    <font size="19"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{year_str} + "/"+(Integer.parseInt($F{year_str})+1)]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="0" y="80" width="550" height="30" uuid="6a14145e-955c-4c1f-b84e-b7224d7b3b11"/>
                <textElement>
                    <font size="19"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{year_int} + "/"+($F{year_int}+1)]]></textFieldExpression>
            </textField>
        </band>
    </summary>
</jasperReport>

 

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...