Jump to content
We've recently updated our Privacy Statement, available here ×

Compare record with previous one or next one


asder99

Recommended Posts

 Hi!

I need an help.

My query result is like that:

ID CAT ITEM
1 A fork
2 A spoon
3 B chair

 

And I need a report that join one or more records by CAT.

Something like:

A fork
  spoon
B chair

 

So I think I have compare the record result with the previuos one, and if it's the same, I have to hide the CAT's text area.

But the question is: how can I call the previous record?

 

Thanks a lot!

 

 

 
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

 Well... going in "trial mode", after a pair of hours I found a way.

I create a new report and in the wizard, in the 5th step, I grouped the results for "CAT".

 

In the "Report Inspector" menu there's a new type of band to create: CAT Group Header.

I create it and I put the CAT field in that band, and the rest in the band "Details".

 

Unfortunatly I didn't find a way to modify an existing report to add the group as I do in the wizard. 

 

Hi all and thanks for the hint! 

Link to comment
Share on other sites

 My previous advice about doing by sql was not the better! In fact, the simpliest way was to use the grouping function of jasperreport. It is what the wizard did : it created a group.

To access to group functions inside iReport, you have to go to Report Inspector window and right click on the report object at the top of the window.

Link to comment
Share on other sites

Coincidentally, I just created some similar output this morning.  I didn't use a wizard, though:

I original had $V{LastFirst} and some other fields in the Detail 1 band.  I have multiple rows that might have the same value for $V{LastFirst}, and I didn't want to repeat that Last/First name until I got to a new one.  In the Report Inspector pane in the Detail 1 section, I selected (left clicked) on $V{LastFirst} and then right clicked on it and selected "Group Selected Element(s)".  Frankly, that didn't help much as far as suppressing repeat values (my output is already in the order I want, by the way).  The easiest way, with or without grouping is to select the item that you want to suppress repeats on (under Detail 1 in the report inspector or right in the design pane) and then in the Properties pane, uncheck the "Print Repeated Values" checkbox!

Carl

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