mickyrox Posted June 24, 2011 Share Posted June 24, 2011 HI people,Jasper by default prints the last check in a group instance when the field is printed in the group footer.Is there a way to print the first check in a group instance?For instanceData in the db: Data in database Birth Date Name City Sex Employed 01/01/2011 Allen NY F NO 02/01/2011 Boris NY M MAYBE 03/01/2011 Carter NY M YES If we group by City in Jasper and print all the fields in the group footer What i get is: 03/01/2011 Carter NY M YES What i need is: 01/01/2011 Allen NY F NO Please ask me if you have any clarifications to make on my requirements. Thanks a bunch in advance,micky Link to comment Share on other sites More sharing options...
cbarlow3 Posted June 27, 2011 Share Posted June 27, 2011 Well, obviously it would be more traditional to put information from the FIRST record per group into a group HEADER instead of a group FOOTER. Actually, it's more traditional to not include ANY information that is unique per detail record into a header OR a footer...I usually see either information that doesn't change within the group (like the field that defines the group itself) or totals that make sense in the group footer to summarize the group as a whole. Nevertheless, it is possible to get some information from your first record in the group and display it in the group footer. Here's a sample query:SELECT ADDRESS.CITY, ADDRESS.STREET FROM CORE.ADDRESS AS ADDRESS ORDER BY ADDRESS.CITYNow I make a group calle CityGroup based on the field $F{CITY}. I'll leave the checkboxes checked to create a group header and group trailer. Into the group header I'll drag the city field that defines the group, and I'll also drag a static label that says "Street". Now I'll create a new variable called $V{AmIFirst}, and I will define the Variable Express for this variable as follows:$V{CityGroup_COUNT}==1 ? $F{STREET} : ""No need to display it on the report, but since this is just an experiment, I dragged this variable into a new column of the detail and added a label in the group header. The intent is that this field will be the same as the value of the $F{STREET} field, but only for the first detail per group. For all the other detail records, it should evaluate to blank.Now I create a second variable (well, third, if you count $V{CityGroup_COUNT}, which was created automatically by iReport when I defined my group) called $V{FirstStreet}. I set the Reset type to "Group", the Reset group to "CityGroup", the Calculation to "Highest" and the Variable expression to $V{AmIFirst}. That way the variable will always be set to the "highest" value of $V{AmIFirst} so far for the currrent group, and since the only two values are actual field values and blank, it should evaluate to the first value for the group. I've never been tempted to try this before, but it looks like it worked in my test...see attached screen shot excerpt.Hope that helps.Carl Link to comment Share on other sites More sharing options...
john.stanton Posted August 17, 2014 Share Posted August 17, 2014 Confirmed that Carl's answer works. I had a similar situation where I wanted the first date from the first row and last date from last column for the groupFooter. Using Carl's approach worked. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now