How to print each record in seperate page of a report

0

Hi Every one , Suppose I have a Query
 ` Select name from inv_investments ` , Usually when we Drop the Name field into Detail and we run the report  in Single Page we might get 20 Investments names
Now i want to print  One Name of investment in One Page.
How can I achieve this.

Thanks.

 

santosh.audi19's picture
Joined: Sep 9 2015 - 9:58am
Last seen: 1 year 1 month ago

1 Answer:

2

Santhosh,

Add Report Group and than click on Start on new page .

 

Example :

<?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="reportCharts" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="280bc2bd-2f2c-49d3-8486-7883e25f53e4">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <subDataset name="New Datase" uuid="0f112c92-c4d3-43bb-9634-8d7e301002ee">
        <queryString>
            <![CDATA[SELECT NAME,count(*) FROM TYPE GROUP BY type.name]]>
        </queryString>
        <field name="name" class="java.lang.String"/>
        <field name="count" class="java.lang.Long"/>
        <group name="name">
            <groupExpression><![CDATA[$F{name}]]></groupExpression>
        </group>
        <group name="count">
            <groupExpression><![CDATA[$F{count}]]></groupExpression>
        </group>
    </subDataset>
    <queryString>
        <![CDATA[SELECT NAME,value FROM TYPE]]>
    </queryString>
    <field name="name" class="java.lang.String"/>
    <field name="value" class="java.lang.String"/>
    <group name="newPage" isStartNewPage="true">
        <groupExpression><![CDATA[$F{name}]]></groupExpression>
        <groupFooter>
            <band height="20">
                <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                    <reportElement x="129" y="0" width="100" height="20" uuid="bd7343be-9e94-4984-a7cf-206d937aa3bb"/>
                    <textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="29" y="0" width="100" height="20" uuid="7b2cef47-3606-40b1-b7a6-fe584e5ab47e"/>
                    <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
                </textField>
            </band>
        </groupFooter>
    </group>
    <columnHeader>
        <band height="22" splitType="Stretch">
            <staticText>
                <reportElement x="29" y="2" width="100" height="20" uuid="b750ab81-dde8-4be2-8c72-ba988e58af62"/>
                <text><![CDATA[name]]></text>
            </staticText>
            <staticText>
                <reportElement x="129" y="2" width="100" height="20" uuid="a5721f23-ab24-4dd7-a8ce-3c9d766c3ac3"/>
                <text><![CDATA[value]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="1" splitType="Stretch"/>
    </detail>
</jasperReport>
 

kotapati.krishna's picture
Joined: Feb 1 2016 - 5:56am
Last seen: 2 months 1 week ago
Feedback
randomness