0
votes

I am having one master report and and need to show 4 different sections in next page. So for those 4 different kind of details , i have created 4 subreports in detail band of main report. Now these 4 reports will be displayed as 4*4 matrix (like 1st and 2nd subreport side by side and 3rd and 4th report just below first and second one , again side by side) now if first and third subreports while runtime didn't got displayed (may be because data which gets populated in them is not present) so space occupied by them is now empty i.e their is space in left hand side of matrix but 2nd and 4th subreports are displayed which are on right hand side. Now here is my query : how can i move 2nd and 4th subreports on left hand side which is empty space?

similary if 2nd subreport is not present , how would i move 4th report up i.e on 2nd subreports place.

so basically i was not able to move subreports either on top or left side which are empty for no data.

Please help as i am badly stuck here from 1 week.

1
Can anyone help me out with above senario for jasper report as I still didn't get through it / not able to find out any way to resolve it.poonam

1 Answers

0
votes

I don't think it's possible to dynamically move subreports on the horizontal plane.
However, you could use the Float value of the Position Type element of your subreports. This would display subreport 3 in the position of subreport 1 of 1 is empty or not displayed and 4 in the position of 2.

There is, however, a complicated way to make it appear as if the report is behaving the way you want it to behave. It requires your main report to detect if one of the subreports is empty. So if you CAN detect that (i.e. your main reports knows when one of your subreports will be empty, e.g. based off of certain values or parameters or the result o a query) you can add every possible combination and positioning of subreports in a different detail band and use the Print When Expression to determine which of these should be displayed.

Example:
Detail 1, print when "all sureports filled"
S1 | S2
S3 | S4

Detail 2, print when "subreport 1 not filled"
S2 |
S3 | S4

Detail X, print when "subreport 2 filled AND subreport 4 filled"
S2
S4
...or whatever arrangement you like.

But I would not recommend doing that. Maintaining the report becomes a pain in the butt and execution times increase drastically.