Dyanamic size of Subreports

Hi !!

I am a new user to Jasper Reports, and i am caught with a serious problem in my project.

I have a report template in which i've created two subreports, placed one below the other in detail band. I've set "split allowed = true" for the detail band and "isStretchWithOverflow = true" for both the subreports. But when the contents in upper subreport overflows, it overwrites the contents of the lower subreport. Is there any method to dyanamically shift down the lower report if the contents of first subreport overflows.

I'm also having a similar problem with text fields where i need to dyanamically shift down the contents of a text field if the contents of report part above it expands.
[file name=medicalRecordMain.jrxml size=22470]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/med...
vaishnav_piyush's picture
Joined: Aug 5 2007 - 5:43pm
Last seen: 16 years 1 month ago

13 Answers:

Set positionType="Float" for the second subreport/text field.

HTH,
Lucian
lucianc's picture
87357
Joined: Jul 17 2006 - 1:10am
Last seen: 2 hours 45 min ago
Thanks you lucianc.... the solution to my problem that you suggested worked wonders... thanks again

it is so amazing to know that i had set almost 2 days trying different things to solve my problem and the solution was so easy.

can you do me one more favour... please suggest me some good reading material on developing jasper reports using ireport... i surfed the material readily available but didn't think that it is good enough to give one conceptual knowledge on jasper reports
vaishnav_piyush's picture
Joined: Aug 5 2007 - 5:43pm
Last seen: 16 years 1 month ago
vaishnav_piyush wrote:
please suggest me some good reading material on developing jasper reports using ireport... i surfed the material readily available but didn't think that it is good enough to give one conceptual knowledge on jasper reports


I'm afraid I can't suggest anything more than what is on [url=http://jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/H... page. The samples included in the JasperReports project distribution are also a good way of learning what JR can do and how it works.

Regards,
Lucian
Post edited by: lucianc, at: 2007/08/10 08:35
lucianc's picture
87357
Joined: Jul 17 2006 - 1:10am
Last seen: 2 hours 45 min ago
Thanx for this post, it helped me a hole lot :)
alexjonk's picture
Joined: Oct 15 2006 - 5:51pm
Last seen: 16 years 11 months ago
would this work the same if the subreports where placed in the "summary" part of the document?

I have set the Position type to float for the second report but the data still overlaps.

Thank you.
vk01's picture
765
Joined: Oct 19 2007 - 1:39am
Last seen: 15 years 11 months ago
vk01 wrote:
would this work the same if the subreports where placed in the "summary" part of the document?


Yes.

Make sure that your subreport elements in the master JRXML do overlap on the horizontal/x axis and that the second is positioned under the first (with no vertical/y overlapping).

Regards,
Lucian
lucianc's picture
87357
Joined: Jul 17 2006 - 1:10am
Last seen: 2 hours 45 min ago
I have the first subreport-1[10,21] and subreport-2[10,61] coordinates - the data overlaps.

any ideas would be much appreciated.
vk01's picture
765
Joined: Oct 19 2007 - 1:39am
Last seen: 15 years 11 months ago
vk01 wrote:
I have the first subreport-1[10,21] and subreport-2[10,61] coordinates - the data overlaps.


Please post the full subreport element coordinates (x, y, width, height).

Regards,
Lucian
lucianc's picture
87357
Joined: Jul 17 2006 - 1:10am
Last seen: 2 hours 45 min ago
subreport-1 - (top,left, height, width) - (21, 10, 0, 0)
subreport-2 - (top,left, height, width) - (51, 10, 0, 0)

thank you - hoping we can get to the bottom of this.
vk01's picture
765
Joined: Oct 19 2007 - 1:39am
Last seen: 15 years 11 months ago
Try setting the widths of the subreport elements to 1.

Regards,
Lucian
lucianc's picture
87357
Joined: Jul 17 2006 - 1:10am
Last seen: 2 hours 45 min ago
THANK YOU!!!! IT WORKED!!!!

Why did this make a difference, setting width to 1?

Why didn't setting the position type to FLOAT for the second subreport work?

Thanks again!!
vk01's picture
765
Joined: Oct 19 2007 - 1:39am
Last seen: 15 years 11 months ago
vk01 wrote:
Why did this make a difference, setting width to 1?


As I said, the engine checks whether the two elements overlap on the horizontal axis. When the elements have 0 as declared width, they do not occupy any space on the horizontal axis, and therefore there is no overlap.

Code:
Why didn't setting the position type to FLOAT for the second subreport work?</td></tr></tbody></table><br />
<br />
Position type Float works only when the condition above (regarding the horizontal overlapping) holds.<br />
<br />
Regards,<br />
Lucian
lucianc's picture
87357
Joined: Jul 17 2006 - 1:10am
Last seen: 2 hours 45 min ago
Feedback