tech_sb Posted June 18, 2015 Share Posted June 18, 2015 I'm new to Ireport (v4.7.1). I want to store database data retrieved with SQL commands in a two dimmensional array where the "x-axis" must be one of the DB fields and the "y-axis" must be the remaining fields according to a field grouping. After this "first run", the data array will be used as a summary data source at the end of the report. I think the best explanation for my requirement is an example: DB data: field1 | field2 | field3 | field4 | --------|--------|--------|--------| 2011 | G1 | X1 | 21 | 2012 | G1 | X2 | 22 | 2013 | G1 | X3 | 23 | 2014 | G1 | X4 | 24 | 2015 | G2 | X1 | 25 | 2016 | G2 | X3 | 26 | 2017 | G3 | X1 | 27 | 2018 | G3 | X2 | 28 | 2019 | G3 | X3 | 29 | 2020 | G3 | X5 | 30 | --------|--------|--------|--------| I want to store the above data in a 2-dim array so the Report Output must read: ---------|--------|--------|--------| label1 | G1 | G2 | G3 | ---------|--------|--------|--------| X1 | 21 | 25 | 27 | X2 | 22 | 0 | 28 | X3 | 23 | 26 | 29 | X4 | 24 | 0 | 0 | X5 | 0 | 0 | 30 | ---------|--------|--------|--------| Note that field2 (G1,G2,G3...) becomes the Heading Label for the Report. Note that not all DB records have data for a particular combination (G1,G2..) and therefore its value must be '0' or 'blank'. Any help to define, populate and read this array will be appreciated. Link to comment Share on other sites More sharing options...
hozawa Posted June 18, 2015 Share Posted June 18, 2015 JasperReports supports Java beans. Have you tried putting the values into a bean and using the bean as a datasource in your report? 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