Results 1 to 1 of 1
Thread: pass data from java to ireport
- 02-07-2013, 03:36 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 1
- Rep Power
- 0
pass data from java to ireport
I am using java and I Report and new to Ireport. Values to I report are passed through java.
I handled only single values not array or group of values .
Now I want to create a chart. with month on x-axis and running(auto increment) values on y-axis. Data are in Map in java , so i can pass Map to Ireport through parameters.How can use this to chart.
I saw example are for SQ L query .
My java code
Usually i retrieve values like this in IreportJava Code:Map<Integer, Map<String, Object>> monthMap = new ProjectCodeBiz().getProjectBudgetAndActualToMonth(projectId, year, period); if (monthMap != null) { Iterator<Integer> monthIterator = monthMap.keySet().iterator(); Integer monthKey; Map<String, Object> sumMap; Iterator<String> sumIterator; String sumKey; while(monthIterator.hasNext()){ monthKey = (Integer) monthIterator.next(); parameters.put(MONTH, monthKey); sumMap = monthMap.get(monthKey); sumIterator = sumMap.keySet().iterator(); while(sumIterator.hasNext()){ sumKey = (String) sumIterator.next(); BigDecimal value = (BigDecimal)sumMap.get(sumKey); parameters.put(sumKey, ObjectUtils.round(value)); } } } //Filling the reports with data jasperPrint = JasperFillManager.fillReport(jasperReport,parameters,dataSource);
Java Code:CDATA[$P{REPORT_PARAMETERS_MAP}.get( "report_title" ) for parameters and CDATA[$F{cp_labour_hour}for datasource.
sample output is
Month: 1
Key: Actual_Cost
Value: 910.00
Key: Actual_Sale
Value: 0.00
Key: Cost
Value: 87300.00
Key: Sale
Value: 97991.25
.....
Month: 17
Key: Actual_Cost
Value: 910.00
Key: Actual_Sale
Value: 0.00
Key: Cost
Value: 92740.00
Key: Sale
Value: 104095.75
Please anybody help me how to retrieve data from map? or If map can not handle in ireport any other way to handle this.
My x-axis is for month should like this M 1, M 2, M 3 ....
and y-axis 100,200,300 etc.
what should i use for Series expression, X Value expression and Y value expression in i report chart properties?
Using graph for four keys so X Y map is OK right?
Please give me suggestions...
Note: data are from two sources, that is why i am using parameter and data source.
Similar Threads
-
pass data between jFrame objects and class in Java
By sajjadbandari in forum New To JavaReplies: 11Last Post: 09-08-2012, 11:11 PM -
How can i pass the data from one JPanel to other...?
By sujay in forum AWT / SwingReplies: 2Last Post: 07-28-2011, 09:01 AM -
how to pass data
By rakesh_mca in forum Java ServletReplies: 7Last Post: 10-25-2009, 01:13 PM -
Struts: pass data to other form
By sgoyal in forum Advanced JavaReplies: 1Last Post: 10-01-2009, 05:12 AM -
Problem for iReport (Data Source )
By tlgkumar in forum Advanced JavaReplies: 1Last Post: 11-27-2007, 07:39 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks