gregory.west Posted June 8, 2016 Share Posted June 8, 2016 I have a report that is a summary only report. This means the group footer lines are the only thing being printed. The question comes up, how do I change the background colour for alternating groups.Here is the solution I can up with:Create a variable, in my case I used GROUP_PRINT Value Class Name:java.lang.Integer Calculation is Sum. Now here comes the magic, what you want to sum up are the number of first group detail records. To do this I used the expression: ($V{Group1_COUNT}==1?1:0) which means when GROUP_COUNT = 1 return 1 for the sum, otherwise return 0. Every group has to have one and only one first line. The Initial Value Expression should be set to 0 (zero) Increment type is none, and Reset type is Report.Now that will give you a variable GROUP_PRINT that will tell you the group number you are on. From there create a frame in your group footer change the frames background colour to what you want and add the following to the Print When of the frame:($V{GROUP_PRINT} % 2) ==0.There you go, group footers in alternating colour backgrounds.Now for my harder question: I have a clause in my footer for print when. How do I tell if a footer was even printed for a particular group? Link to comment Share on other sites More sharing options...
gregory.west Posted June 18, 2016 Author Share Posted June 18, 2016 Does anyone have any thoughts, I am even interested in out of the box ideas. Right now I have a report that is supposed to be blue band, white band, blue band etc.... What I get is White, Blue, Blue, White, White, White, Blue, White, Blue, Blue... Depending on which summary lines are being printed. Is there a way I can count up the summary lines that have been printed? Greg Link to comment Share on other sites More sharing options...
gregory.west Posted June 24, 2016 Author Share Posted June 24, 2016 Is there any way in Jasper Reports that I can tell / control in which order parameter fields are re-calculated? This is a possible solution to the problem but I need a couple parameter fields to be recalculated in a very specific order.Field1: Summary-Lines = Summer-lines + (Last-Group-ID != Current-Group-ID and Last-Group-Printed?1:0)Field2: Last-Group-Printed = 'print when conditionFiels3: Last-Group-ID = Current-Group-IDThe major trick here is these three fields MUST be recalculated in order, Field1, then Field2, last Field3. Is this possible? 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