java - Conditional List Looping in JasperReport -


if size of list greater 2, there attachment(another template) file list.

<![cdata[$p{policyinsuredpersonbeneficiarieslist}.size() < 3]]> 

report :

<parameter name="policyinsuredpersonbeneficiarieslist" class="java.util.list"/> ..... <componentelement>     <reportelement uuid="e7c57647-5643-443f-bc07-c0e4ff6c5392" x="124" y="412" width="140" height="18" isprintwhendetailoverflows="true">         <printwhenexpression><![cdata[$p{policyinsuredpersonbeneficiarieslist}.size() > 2]]></printwhenexpression>     </reportelement>     <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printorder="vertical" ignorewidth="false">         <datasetrun subdataset="dsinsuredpersonbeneficiaries" uuid="03295256-f4a3-4bd9-85bf-7a01896a544b">             <datasourceexpression><![cdata[new net.sf.jasperreports.engine.data.jrbeancollectiondatasource($p{policyinsuredpersonbeneficiarieslist})]]></datasourceexpression>         </datasetrun>         <jr:listcontents height="18" width="140">             <textfield isstretchwithoverflow="true">                 <reportelement uuid="8a76ba89-7f02-4755-86d0-c9789925bf2a" stretchtype="relativetobandheight" x="0" y="1" width="140" height="15"/>                 <textelement>                     <font fontname="zawgyi-one" size="10"/>                 </textelement>                 <textfieldexpression><![cdata[$f{fullname}+" - "+$f{percentage}+"% - "+((org.ace.insurance.system.common.relationship.relationship)$f{relationship}).getname()]]></textfieldexpression>             </textfield>         </jr:listcontents>     </jr:list> </componentelement> 

i following exception :

1) generatelifepolicyissuesingle(org.ace.insurance.report.test.reporttest) java.lang.indexoutofboundsexception: index: 2, size: 2     @ java.util.arraylist.rangecheck(unknown source)     @ java.util.arraylist.remove(unknown source)     @ java.util.collections$synchronizedlist.remove(unknown source)     @ net.sf.jasperreports.engine.jasperprint.removepage(jasperprint.java:535)          

btw : use jasperreport 5.1


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -