[#13216] - Text Field printing a string concatenation variable can't "stretchHeight" if variable has reset type

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

Very easy to reproduce. Attachment has a fully functional example.

It happens when you have a variable that concatenates Strings from a group.
When you put this variable to show in a text field in the group header or footer, the text field is unable to stretch it's height as any text field should.

I noticed that this happens when the variable is set to reset on group change. If I set the reset type to "none", it stretches normally.

I'm sure the variable is holding the full content of the concatenation. You can check this by increasing the height of the text field.

AttachmentSize
Binary Data concatenation.jrxml2.88 KB
File fakecsvdata.xml822 bytes
File data.csv381 bytes
Package icon ignore7.31 KB
Package icon ignore2.06 KB
v6.14.0
gustavofarias's picture
Joined: May 22 2012 - 7:10am
Last seen: 1 week 3 days ago

3 Comments:

#1

This behavior occurs because the textfield itself has a delayed evaluation (evaluationTime="Group" evaluationGroup="Section") in order to print the complete variable value. In case of a delayed evaluation, textfields stretching is inhibited as explained in the xsd schema ( http://jasperreports.sourceforge.net/schema.reference.html#textField_tex... ).

In this case, instead of a textfield you could use an element that performs calculations on a subdataset, like a subreport or a table component.

#2

How can I use the records inside a group as subdataset for a subreport or table? All my data come from a single query, and it would be very costly to submit a new query for each group.

#3

Depending on the report datasource, there are different possibilities to reuse it among several report components. Some useful examples can be found here:
https://community.jaspersoft.com/wiki/reusing-subdataset-data-report
Another way is to refactor the report query in order to retrieve only the needed fields and use parameterized queries in subdatasets.
For the sample attached here, we could simply read the data from the same csv source and use filter expressions in subdatasets (see the modified jrxml example in the attachment).

AttachmentSize
Binary Data concatenation_modified.jrxml5.05 KB
Feedback