Columns can be hidden dynamically by using Jaspersoft iReport’s Table Component (Note: Styling & Group/Sub Group Totals will have to be manually added).

JS-Tbl-Component.PNG

To use the Table Component, first add a dataset to the report (select the report in the ‘Report Inspector’ and right click, then select ‘Add Dataset’). Then add the Table to the Summary section of the report.

Once the table has been added to the report, select the column to be hidden, in the column’s properties, select ‘Column Print When’ and add an expression which evaluates to True or False in the following format:

new Boolean($P{Columns}.contains('2'))

JS-Column-Properties.PNG

Using a condition or by using a parameter with Parameter Class equal to java.util.Collection you can control which columns get displayed. An input control with Column Names & Values could be added on Jasperserver.

List-Of-Values.PNG

Clicking on the column heading (table component) of a report that is loaded on Jasperserver allows you to sort, filter or hide the column.

Share This