Jump to content
We've recently updated our Privacy Statement, available here ×

amitpandey

Members
  • Posts

    3
  • Joined

  • Last visited

amitpandey's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hello all, In my report i have 2 List (OD_List, TP_List). I put them in MAP. Now i want to get the values in sub seport. I pass values in subreport like MainReport.jrxml <parameter name="OD_BLOCK" class="java.util.Map"> <defaultValueExpression><![CDATA[$P{OD_BLOCK}]]></defaultValueExpression> </parameter> <parameter name="TP_BLOCK" class="java.util.Map"> <defaultValueExpression><![CDATA[$P{TP_BLOCK}]]></defaultValueExpression> </parameter> <subreport> <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="233" width="595" height="216"/> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="TP_BLOCK"> <subreportParameterExpression><![CDATA[$P{TP_BLOCK}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="OD_BLOCK"> <subreportParameterExpression><![CDATA[$P{OD_BLOCK}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "sub_report.jasper"]]></subreportExpression> </subreport> How can i display in subreport ? Code:private List OD_List() { List odList = new ArrayList(); odList.add("1"); odList.add("2"); odList.add("3"); odList.add("4"); return odList;}private List TP_List() { List tpList = new ArrayList(); tpList.add("11"); tpList.add("12"); return tpList;}private Map OD_BLOCK() { Map map = new HashMap(); map.put("OD_1", OD_List()); return map;}private Map TP_BLOCK() { Map map = new HashMap(); map.put("TP_11", TP_List()); return map;}Map<String, Object> mapParameter = new HashMap<String, Object>();mapParameter.put("OD_BLOCK", OD_BLOCK());mapParameter.put("TP_BLOCK", TP_BLOCK());JasperPrint print = JasperFillManager.fillReport(file, mapParameter, new JRBeanCollectionDataSource(policyList));JRExporter exporter = new JRPdfExporter();exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);exporter.exportReport();mapParameter = null;if (outFileName != null && outFileName.length() > 0) return outFileName;
  2. Hi all, I am facing the problem in iReport with Beans integrations. I get the policyId, PolicyNo, receiptMasterCollection but i could not get the proposal values like proposalId from Proposal Beans. Can any one help me. And here is my BeansPolicy private java.lang.Long policyId; private java.lang.String policyNo; private Proposal proposal; private List receiptMasterCollection; public java.lang.Long getPolicyId() { return policyId; } public void setPolicyId(java.lang.Long policyId) { this.policyId = policyId; } public java.lang.String getPolicyNo() { return policyNo; } public void setPolicyNo(java.lang.String policyNo) { this.policyNo = policyNo; } public Proposal getProposal() { return proposal; } public void setProposal(Proposal proposal) { this.proposal = proposal; } public List getReceiptMasterCollection() { return receiptMasterCollection; } public void setReceiptMasterCollection(List receiptMasterCollection) { this.receiptMasterCollection = receiptMasterCollection; } -------------------------------------- Proposal private java.lang.Long proposalId; public java.lang.Long getProposalId() { return proposalId; } public void setProposalId(java.lang.Long proposalId) { this.proposalId = proposalId; } -------------------------------------- ReceiptMasterCollection private java.lang.Long receiptID; public java.lang.Long getReceiptID() { return receiptID; } public void setReceiptID(java.lang.Long receiptID) { this.receiptID = receiptID; } --------------------------------------Here is my ".jrxml" files POLICY_MOTOR.jrxml <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="POLICY_MOTOR" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0"> <property name="ireport.scriptlethandling" value="0"/> <property name="ireport.encoding" value="UTF-8"/> <property name="net.sf.jasperreports.export.pdf.compressed" value="true"/> <property name="net.sf.jasperreports.export.pdf.encrypted" value="false"/> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.*"/> <import value="net.sf.jasperreports.engine.data.*"/> <parameter name="SUBREPORT_DIR" class="java.lang.String"> <defaultValueExpression><![CDATA["D:\\Code\\Java\\SGI\\2009\\10\\Citizen_1.1\\GWT_1_6_Shrisurance\\SrisureHome\\www\\com.shrisure.SrisureHome\upload_files\\JasperReports\\"]]></defaultValueExpression> </parameter> <field name="policyId" class="java.lang.Long"> <fieldDescription><![CDATA[policyId]]></fieldDescription> </field> <field name="policyNo" class="java.lang.String"> <fieldDescription><![CDATA[policyNo]]></fieldDescription> </field> <field name="proposalId" class="java.lang.Long"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="receiptMasterCollection" class="java.util.List"> <fieldDescription><![CDATA[receiptMasterCollection]]></fieldDescription> </field> <detail> <band height="200" splitType="Stretch"> <textField> <reportElement x="99" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.Long"><![CDATA[$F{policyId}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="0" width="100" height="20"/> <textElement/> <text><![CDATA[Policy ID]]></text> </staticText> <textField> <reportElement x="99" y="19" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{policyNo}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="19" width="100" height="20"/> <textElement/> <text><![CDATA[Policy No]]></text> </staticText> <staticText> <reportElement x="0" y="38" width="100" height="20"/> <textElement/> <text><![CDATA[Proposal No]]></text> </staticText> <textField> <reportElement x="99" y="38" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.Long"><![CDATA[$F{proposalId}]]></textFieldExpression> </textField> </band> </detail> <pageFooter> <band height="103" splitType="Stretch"> <subreport isUsingCache="true"> <reportElement x="0" y="0" width="595" height="67"/> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{receiptMasterCollection})]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "RECEIPT.jasper"]]></subreportExpression> </subreport> </band> </pageFooter> </jasperReport>
  3. Hi all, I am facing the problem in iReport with Beans integrations. I get the policyId, PolicyNo, receiptMasterCollection but i could not get the proposal values like proposalId from Proposal Beans. Can any one help me. Post Edited by amitpandey at 01/01/2010 05:32
×
×
  • Create New...