How to iterate HashMap(Arraylist) into jrxml?

0

Hi all,

            I am new to jasper, i am learing that how to use jsper to generate PDF and excel report and jasper help me to generate these kind of report. 

Now I am trying to iterate the values of HashMap into jrxml and in hashMap the values are passed as list, so I pass hashMp to fillReport, but on jrxml side how to iterate hashmap? 

please help me to iterate hashMap on jrxml side?

List<String> severity = // some values;
List<String> messages = // some values;
 
 
LinkedHashMap parameters = new LinkedHashMap();
        parameters.put("severity", severity);
        parameters.put("messages", messages);
 
jPrint = JasperFillManager.fillReport(jasperreport,parameters,new JREmptyDataSource());             
              JasperExportManager.exportReportToPdfStream(jPrint,baos);   

dhairyashil.bhosale584's picture
Joined: Dec 28 2015 - 10:07pm
Last seen: 3 years 6 months ago

2 Answers:

0

I added parameter in jrxml but how to iterate those parameter in jrxml?

 <parameter name="severity" class="java.util.ArrayList"></parameter>
<parameter name="messages" class="java.util.ArrayList"></parameter>
 
//In textField added:
<textFieldExpression><![CDATA[$F{severity}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{messages}]]></textFieldExpression>

like above I am trying to iterate the severity and message parameter in jrxml ?

dhairyashil.bhosale584's picture
Joined: Dec 28 2015 - 10:07pm
Last seen: 3 years 6 months ago
1

Haven't done this myself but did you create a parameter with  HashMap datatype and created scriplets to process the parameter?

hozawa's picture
45109
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 1 week ago
Feedback
randomness