jigar.prajapati Posted April 20, 2017 Share Posted April 20, 2017 Currently i m creating report with table. i m new at i-report.I create table in whihc i get data from collection(Java.util)a and later i partition it in as i required..i want to use that table dataset field or dataset variable to pass main report.i have no of columns each column have one unique vaule in field.i want to get that variable vaule or filed value in main reporthere is the code which i try:<?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="TestingImage" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="5470e3fc-1c9c-4841-8814-e3a935fa6684"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="288"/> <style name="table"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="ImageDemoDataset" uuid="47414685-b792-4a30-9b14-fc32127ad3cc"> <queryString> <![CDATA[]]> </queryString> <field name="firstname" class="java.lang.String"/> <field name="lastname" class="java.lang.String"/> <field name="email" class="java.lang.String"/> <field name="phone_number" class="java.lang.String"/> <field name="picture" class="java.lang.String"/> <variable name="imagePath" class="java.lang.String" resetType="None"> <variableExpression><![CDATA[$F{picture}]]></variableExpression> </variable> </subDataset> <parameter name="ImageDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> <variable name="varImage" class="java.lang.String" resetType="None"/> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"/> </columnHeader> <detail> <band height="364" splitType="Stretch"> <componentElement> <reportElement x="18" y="0" width="474" height="216" uuid="771aa5d8-1470-4fd9-b062-a913b6014f19"/> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" whenNoDataType="AllSectionsNoDetail"> <datasetRun subDataset="ImageDemoDataset" uuid="78f8e35f-b65c-44fb-9a82-71352f17b0f7"> <dataSourceExpression><![CDATA[$P{ImageDataSource}]]></dataSourceExpression> <returnValue fromVariable="imagePath" toVariable="varImage"/> </datasetRun> <jr:column width="70" uuid="6aa96500-79ab-4b8b-aa5f-0c9dbc22638f"> <jr:detailCell height="30" rowSpan="1"> <textField> <reportElement x="0" y="0" width="70" height="30" uuid="9528bbd1-627c-424c-a3f0-872f92799c94"/> <textFieldExpression><![CDATA[$F{firstname}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="90" uuid="ba88fb55-d423-4d1e-99a1-b81c44f6e65a"> <jr:detailCell height="30" rowSpan="1"> <textField> <reportElement x="0" y="0" width="90" height="30" uuid="5c85fd56-54ba-4d22-a3e4-adcdbbbc2b4f"/> <textFieldExpression><![CDATA[$F{lastname} + ""+$V{imagePath}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="100" uuid="29524685-b68a-4906-be22-50b0acacba7d"> <jr:detailCell height="30" rowSpan="1"> <textField> <reportElement x="0" y="0" width="100" height="30" uuid="9dacce68-21ca-4bcc-b9cb-bad1b3661611"/> <textFieldExpression><![CDATA[$F{email}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="94" uuid="4bb9635f-4173-4c5b-95ce-5a12a2332ea1"> <jr:detailCell height="30" rowSpan="1"> <textField> <reportElement x="0" y="0" width="94" height="30" uuid="8c6c58b1-d3fd-4fad-995a-caaaea6afe8e"/> <textFieldExpression><![CDATA[$F{phone_number}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="100" uuid="b500de9f-6abf-41b8-9e5d-d408b94d32ce"> <jr:detailCell height="30" rowSpan="1"> <textField> <reportElement x="0" y="0" width="100" height="30" uuid="0e6a1e56-974f-41a3-af08-0cf5b832b573"/> <textFieldExpression><![CDATA[$F{picture}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> <image scaleImage="FillFrame" hAlign="Center" vAlign="Middle"> <reportElement x="48" y="266" width="100" height="98" uuid="290e1eb9-3a18-4a65-93d4-d155b98ce964"> <printWhenExpression><![CDATA[!$V{varImage}.equalsIgnoreCase("null")]]></printWhenExpression> </reportElement> <imageExpression><![CDATA["C:\Users\jigpra\Pictures\"+$V{varImage}]]></imageExpression> </image> <staticText> <reportElement x="48" y="231" width="100" height="20" uuid="32fd136d-d7c4-4256-be6c-e9ad7d5f7592"/> <textElement> <font size="12"/> </textElement> <text><![CDATA[$V{varImage}]]></text> </staticText> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary></jasperReport>waiting for your responsethank you. 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