0

I am new to Jasper reports. I am using Jaspersoft iReport Designer 4.5.1. to create a report with a dataset of the following format (Let me call it Format1):

╔═══════╦════════════╦═════════════╗
║ Date  ║ Q1         ║    Q2       ║
╠═══════╬════════════╬═════════════╣
║ d1    ║ 45.5       ║  50.6       ║
╚═══════╩════════════╩═════════════╝

where Q1 and Q2 are some computed quotients. Now Jasper designer asks for Series (different colors), Category (X-axis) and Value (Y-axis). Since my "values" are spread across columns, I need to unpivot the data to obtain this format: (Format2)

╔═══════╦════════════╦═════════════╗
║ Date  ║ Quo Type   ║    Values   ║
╠═══════╬════════════╬═════════════╣
║ d1    ║ Q1         ║ 45.5        ║
║ d1    ║ Q2         ║ 50.6        ║
║       ║            ║             ║   
╚═══════╩════════════╩═════════════╝

to be able to pass 'Quo Type' as Series, 'Date' as Category and 'Values' as Value. But this will need me to modify the MySQL query attached to the datasource. Since I have a lot of queries in Format 1 for report generation, can this conversion be avoided somehow? Is there a way to use the Format1 to create the reports?

Aafreen Sheikh
  • 4,949
  • 6
  • 33
  • 43
  • I think my question is the reverse of this: http://stackoverflow.com/questions/13174265/how-to-create-dynamic-columns-in-jrxml-file-for-jasper-report-generation – Aafreen Sheikh Dec 03 '12 at 10:41

1 Answers1

0

I had also faced a similar issue while using charts for my reports. I had to pivot my columns to achieve the desired output. May be using a separate dataset could help to reduce the complexity. But one cant avoid pivoting/unpivote the columns.

Rashmi Nagaraja
  • 801
  • 11
  • 20