I want to adding dynamic columns to my select statement. Is it possible? If not can I achieve this with Jasper report? Which tool I have to use in JasperReport? Please help me. I am adding my current table and the wanted table.
My table:
order_id product_id alternative_id 1 12 15 1 12 16 1 12 17 1 13 1 14 2 18 19 2 20 21 2 20 22 2 23 2 24 25
I wanted to create this table in jasper report. Is it possible?
order_id product_id alternative_id1 alternative_id2 alternative_id3 1 12 15 16 17 1 13 1 14 2 18 19 2 20 21 22 2 23
3 Answers:
you can dynamically display columns using the "table" component, but I think you have to know the names of all potentially displayed columns in advance, and account for them all in the jrxml. IF that's your case, then the table component will work, and it can optionally display a subset of those available columns. otherwise, you'll have to use a programmatic approach with jasper via java, or alternatively you can generate dynamic jrxml using apache velocity.
this reference is dated but the solution is still valid:
http://thinkinginsoftware.blogspot.com/2011/06/ireport-dynamically-hide-...
Are you using Adhoc Views? If so, you can add selectable columns dynamically.
Sample of adding columns dynamically (add new column around 55 seconds)
https://www.youtube.com/watch?v=bXD1HBZzA14
If you're using Jaspersoft Studio, try using crosstab component.
https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-u...