Jump to content
JasperReports 7.0 is now available ×

Show Multiple Columns with a footer


rafaelviana

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

uhm...

you can show a texfiled only in the last column using this print when expression

new Boolean($V{COLUMN_NUMBER}.intValue()==3)

use the max number of columns instead of 3...

and placing this textfield in the first column footer.

in this way it appears in all pages but only on the 3° column.

if you 'd show it only in the last page, you can use the last page footer band or the summary band;
in this bands there aren't columns so, you can place your field under the last columns...

 

____________________________________
if it works... give me KARMA points please!    : ) 
____________________________________
 



Post Edited by slow at 05/07/2010 08:37
Link to comment
Share on other sites

Ok. Thanks.

But it isn't enough because if I fix the value in 3 for example.There can be situation that only 1 column is filled, so the footer will not be showed. How can I know the number of total columns instead of use the static value.eg: 3?

 

Link to comment
Share on other sites

Thanks! I got it!
 

In the datasource i put it:

private final int COLUMNS = 5;
private final int RECORDS_PER_COLUMN = 55;

private int LAST_PAGE;
private int LAST_COLUMN;
 

LAST_PAGE = (int) Math.ceil( ((double) numero.size()) / (COLUMNS * RECORDS_PER_COLUMN ) );
LAST_COLUMN = (int) Math.ceil( ( ((double)(numero.size()) % (COLUMNS * RECORDS_PER_COLUMN )) / RECORDS_PER_COLUMN ) );
 

And in the column footer i put this expression:

new Boolean ( $V{COLUMN_NUMBER}.equals($F{LAST_COLUMN}) && $V{PAGE_NUMBER}.equals($F{LAST_PAGE}) )

 

 

 

i think it also could be make inside the Ireport switching the fields by the expression used in Java, the size of the list is in the variable: REPORT_COUNT.

Something like this, only needs to find a manner to use the Math.ceil

new Boolean ( $V{COLUMN_NUMBER}.equals($(int) Math.ceil( ( ((double)(REPORT_COUNT) % (5 * 55)) / 55 ) )) && $V{PAGE_NUMBER}.equals( (int) Math.ceil( ((double) REPORT_COUNT) / (5 * 55 ) )) )

 

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