Jaspersoft prints wrong values in a text field expression

Hi everyone,

i had created a Jasperreport that prints the name of a city (f.e. "Munich") and the name of a country (f.e. "Bavaria"). If I run the preview I get the strange error that the program prints for both fields value "Bavaria". So the country name is equal the cityname.

I check the SQL query and the data in the database, but there, everything looks correct. If I run the query in a databasemanager, I got the correct values. Also in a corresponding BIRT Report the values are printd correctly. 
So I think this have to be a problem of Jaspersoft and not problem of the query. I checked the report and only hint I found was, that the field of the cityname is the only field that has no property of name "com.jaspersoft.studio.field.tree.path". Any other fields are mapped to the database table with this property. I added this property, but this did not bring a change.

Any ideas why this happened?




mpolo91's picture
Joined: Nov 30 2022 - 8:23am
Last seen: 5 months 3 days ago

Are you using any default values on the text property? Can you share a copy of your jrxml file here?

JRS-SE - 6 months 1 day ago


I did not use default values, but now after rewriting the sql query it works. We think the problem was a left join in the query, that is now replaced with a subselect. But its strange. Why the old query works correctly in Birt and DBeaver and not in Jaspersoft?
With the old query the field value where configured on this way:

 <field name="Countryname" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="Cityname"/>
        <property name="com.jaspersoft.studio.field.label" value="Countryname"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="DATATABLE_NAME"/>
 <field name="Cityname" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="Cityname"/>
        <property name="com.jaspersoft.studio.field.label" value="Cityname"/>

mpolo91 - 6 months 1 day ago

0 Answers:

No answers yet