Jump to content
Changes to the Jaspersoft community edition download ×

Subreport threads execution order

Recommended Posts

By: varunn - varunnagpal

Subreport threads execution order

2006-03-20 06:34



I have multiple subreports in my report. The layout is somewhat like this:-


C1 C2 C3 C4 C5


TF SR1 SR2 SR3 SR4}-->One row of detail band


where C1-5 are Column Headings (Static Text)

TF is TextField.

SR1-4 are subreports.


All report elements have stretchType="RelativeToBandHeight" attribute set.


Assuming detail band height = subreport page height = subreport detail band height = 25


The problem that I face is that if SR1 has 2 rows then the height of SR1 becomes 50.

Now, TF stretches vertically to the new Band height i.e. 50, whereas, SR2,SR3,SR4 which have 1 row each do not stretch vertically. (I detect stretching by making the elements Opaque and providing backcolor)


I suspect the reason being that by the time the threads which fill SR2,SR3,SR4 are complete the band height has not yet stretched to 50 i.e. filling of SR1 is not yet complete.


The evidence supporting my conjecture is that if SR4 has 2 rows and SR1,SR2,SR3 have 1 row each then this problem does not occur.


Can anyone explain this behaviour otherwise?

Is subreports filling asynchronous in Jasper?

In another thread, C-Box has mentioned that it is not and that the main report filler waits for one subreport to finish before starting the next thread, in case of multiple subreports.


Please clarify.





Varun Nagpal.





By: C-Box - c-box

RE: Subreport threads execution order

2006-03-20 06:49

Did I really mentioned this!?!?!? I can't remember right - but as I have answered many postings it's hard to keep everything in mind. :-) Which of my postings you refer to!?!?


So what I would try in your case is to place a invisible line (foregroundcolor = backgroundcolor) below the subreports as wide as the page is and it's y-coordinate = band-height. This line you should set to "fixRelativeToBottom" and then the other SubReports should also stretch to band height (also try relativeToTallesObject).


Perhaps this works (not sure, just a guess)







By: varunn - varunnagpal

RE: Subreport threads execution order

2006-03-20 07:23

Apologies! It was Lucian and not C-Box, who quoted that.


Sorry for the wrong info.


Anyway, I had thought of the following solution, to place a rectangle in the detail band, which will have the same co-ordinates as the subreports. Rectangle will be opaque and subreports will be transparent.

Rectangle will have stretchType as RelativeToBandHeight.

Since elements in the main report conform to the stretched band height, the rectangles will stretch and I will get the desired backColor.


The solution that you have suggested, makes me think that, by using that design, we will be forcing the JR Filling engine to render an element after(in terms of co-ordinates) the subreports. And hence, the heights of the subreports will be recalculated.


Am I correct here?


I will try both the tricks and post the results here shortly.

Apologies and thanks again to C-Box!





By: varunn - varunnagpal

RE: Subreport threads execution order

2006-03-31 02:27



It didnt work as u suggested!

I get a line and I still get the unevenly stetched sub-reports in each of the columns.

Any ideas?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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