Jump to content

Showing several designs inside the same report


lgarreau

Recommended Posts

Hi,

 

I am a Jasper newbie; I've spent some time trying to get myself used to iReport, but I have a problem I cannot solve:

 

Say I have some items of type 1 or 2. Each item type has its distinct report (despite some common fields, the layouts as well as the other fields being different). I'd like to create one report able to show say 4 items (each item on a distinct page inside the report) in a specific order (defined by the SELECT clause).

 

I've tried the following (when playing with iReport in order to learn it): I've defined 2 reports, one for each item type (all band sizes to zero but the detail band) and a third report having the other 2 reports as subreports inside the detail band(with a print when expression, depending on the item type value).

 

There are 2 problems with this approach:

- there are some blank pages at the end of the main report

- the order of the records defined by the SELECT clause is altered: more specifically, say the SELECT brings 4 items, i1, i2, i3 and i4, of types 1, 2, 2 and 1, respectively. The report will show items in the following order: i1, i4, i2 and i3 (i.e., there is some type grouping, the item order for a given type being respected).

 

I am not sure my approach is the correct one.

Please advice,

Many thanks,

Loic

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Blank pages can easily be caused by band heights/split configuration. Check the size of the subreport (page dimensions) aswell.

 

On the SQL front, you probably need to clean up the SQL order by/ group by to make sure that Jasper receives the data in the correct order; it sounds like it may not be cascading correctly.

 

If you could explain a bit more about the application (data model), there may be a fighting chance. Sounds like the data isn't completely referential...but all is coming from a single query???

 

You could think about using print when expressions for different types as an alternative to avoid sub-reports.

Link to comment
Share on other sites

Thank you, Rob.

 

I'll (re)check the page dimensions as you suggest :)

 

As far as the item order is concerned, I am pretty sure (used some System.out.println) that the report does change the SQL order. To simplify things, say I have tables A, B, C (all having a column in common as a PK) and the SQL order looks like SELECT * FROM A, B, C with outer joins. Table A contains common columns for types 1 and 2; tables B,C contain specific info for types 1 and 2, respectively. This architecture is partly justified by the huge number of columns and DB limitations (total number of row data bytes on Oracle < 8k ==> only one table couldn't store all data for both types 1 and 2).

 

"You could think about using print when expressions for different types as an alternative to avoid sub-reports." <== I don't quite follow you. Do you suggest to put print when clauses at an iReport field level? This would be painful, because there is a huge number of fields. If I create only one report with print when clauses at field level and a report height = A4 height and put all my fields (now defined in the two subreports) it would be a nightmare to maintain it (from a visual point of view, because the fields would overlap...). If, on another hand, I create a report with a height = height A4 * 2, I don't see any clue in order to collapse heights in order to get only a height = A4 for each item returned by the SQL clause.

 

Thanks again,

Loic

Link to comment
Share on other sites

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