2006 IR Open Dicussion Posted August 26, 2006 Share Posted August 26, 2006 By: miwsney2 - miwsney2 print when group changes 2006-01-25 04:07 I have a report that shows the totalweight of certain species ($F{SPECIES}). The species are also devides in subspecies ($F{SUBSPECIES}. The weights of each subspecies is cumulated to finally receive the total sum per species. I have created a group species. The Variable Totalspecies which is sum of weights is reset when group species changes. The variable is shown in the detail section. I only want to print the variable on the lowest line of the speciesgroup (latest subspecies). I checked the printwhengroupchanges checkbox but the field is allways printed in each detailline. This allways shows the same value which isn't wat i want. Isn't this the usage for printwhengroupchanges? Do i have to do something else? EG: BEEF OX 500 2300 BEEF BULL 1000 2300 BEEF COW 800 2300 PORK PIGLET 300 1200 PORK PIG 900 1200 SHOULD BE: BEEF OX 500 BEEF BULL 1000 BEEF COW 800 2300 PORK PIGLET 300 PORK PIG 900 1200 By: Lucian Chirita - lucianc RE: print when group changes 2006-01-26 01:52 If you don't mind having an empty text on the lines where you don't want to show the total, you can use the newly added Auto evaluation type. This is currently available on the CVS version and will be part of the next release. With Auto evaluation type, you'd be able to use in the same expression values of the group count variable taken at different moments. By comparing the value of the group count variable at detail time (which represents the index of the row in the group) with the value of the group count variable at group time (which is the number of details in the group) you can decide whether the current row is the last one in the group. As Auto evaluation time uses the variable's reset type to determine when to evaluate the variable, you'll have to copy the group count value into a variable that has None reset type: <variable name="groupIdx" class="java.lang.Integer" resetType="None"> <variableExpression>$V{Group_COUNT}</variableExpression> </variable> Then, in the text field having Auto evaluation time you can use the following text expression: $V{groupIdx}.equals($V{Group_COUNT}) ? String.valueOf($V{GroupTotal}) : "" You will also need a recent fix related to the group count variables (JRDesignDataset.java rev 1.13). Regards, Lucian 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