Table Data Repeating Issue

0

I m using the table in the iReport to present my report.The data is also displaying but the table gets repeated and the data also get repeated .I m having only 21 rows to display but its providing the ooutput of about 23 pages.

I have checked all the properties but no good luck the data is repeating in the table and also the pages in the output is also increasing.

Please suggest in which band i need to place the table and  which properties i need to check to stop the repition of data.

Thanks and regards,

shardalule's picture
Joined: Nov 18 2010 - 10:30pm
Last seen: 8 years 6 months ago

11 Answers:

1

If you can paste your jrxml in the "Code:" box on the forum, it might help us analyze the problem.  I don't know about "tables", but when you use a chart to summarize a group or all of the detail lines, the chart would typically go in the Summary band, which only appears once in the report.  Anything you put in the Detail band will normally appear once for every row returned from the query.

Carl

cbarlow3's picture
1387
Joined: Mar 4 2010 - 8:59am
Last seen: 6 days 3 hours ago
0

I have pasted the code below .The query contains only ten rows but while displaying the report it showing around 7 pages.

Even i kept the table in the summary band but it stills repeating the values.

Please suggest  if possible.

Thanks and regards

 

Code:
<?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 <a href="http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"" target="_blank">http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"</a> name="Test1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="98"/>
	<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 1">
		<box>
			<pen lineWidth="1.0" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<subDataset name="Report">
		<queryString language="SQL">
			<![CDATA[  SELECT userid FROM users u limit 0,10]]>
		</queryString>
		<field name="userid" class="java.math.BigInteger"/>
	</subDataset>
	<subDataset name="New Dataset 1">
		<queryString language="SQL">
			<![CDATA[  SELECT userid FROM users u limit 0,10]]>
		</queryString>
		<field name="userid" class="java.math.BigInteger"/>
	</subDataset>
	<queryString language="SQL">
		<![CDATA[SELECT userid FROM users u limit 0,10]]>
	</queryString>
	<field name="userid" class="java.math.BigInteger"/>
	<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="74" splitType="Stretch">
			<componentElement>
				<reportElement key="table 1" style="table 1" x="47" y="10" width="90" height="48"/>
				<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components <a href="http://jasperreports.sourceforge.net/xsd/components.xsd">" target="_blank">http://jasperreports.sourceforge.net/xsd/components.xsd"></a>
					<datasetRun subDataset="New Dataset 1">
						<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
					</datasetRun>
					<jr:column width="90">
						<jr:tableHeader style="table 1_TH" height="30"/>
						<jr:tableFooter style="table 1_TH" height="30"/>
						<jr:columnHeader style="table 1_CH" height="30">
							<staticText>
								<reportElement x="0" y="0" width="90" height="30"/>
								<textElement/>
								<text><![CDATA[userid]]></text>
							</staticText>
						</jr:columnHeader>
						<jr:columnFooter style="table 1_CH" height="30"/>
						<jr:detailCell style="table 1_TD" height="20">
							<textField>
								<reportElement x="0" y="0" width="90" height="20"/>
								<textElement/>
								<textFieldExpression class="java.lang.Number"><![CDATA[$F{userid}]]></textFieldExpression>
							</textField>
						</jr:detailCell>
					</jr:column>
				</jr:table>
			</componentElement>
		</band>
	</detail>
	<columnFooter>
		<band height="45" splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="54" splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band height="42" splitType="Stretch"/>
	</summary>
</jasperReport>
</td></tr></tbody></table>
shardalule's picture
Joined: Nov 18 2010 - 10:30pm
Last seen: 8 years 6 months ago
1

Where are you putting your table? If you put it in the details band, it's going get repeated per data source row.

hozawa's picture
42044
Joined: Apr 24 2010 - 4:31pm
Last seen: 14 hours 51 min ago
0

I can't even load your jrxml without an error...the Table support must not have made it to the Professional version yet.  But in the jrxml, it looks like you still have your table in the Detail band, when it should probably be dragged into the summary band, as has been suggested twice now.  Additionally, it looks to me like your table is using a subdataset (although I don't see any fields defined in that subdataset), but then you include a field from your main dataset in a cell of the table.  If your only problem is the repeating of valid data on your report, then ignore my comment about the subdataset.  If you're having other problems as well (the table is not only repeating but looks empty/wrong), you might look into that subdataset.

Good luck!

Carl

cbarlow3's picture
1387
Joined: Mar 4 2010 - 8:59am
Last seen: 6 days 3 hours ago
0

Hello,

I am having the same problem. The thing is that if I put my graphs and my text fields in summary, then, if I have more than one page, only the first page is going to have page footer and page header.

I am trying to display some charts in diferent pages keeping the page footer and the page header. If I put my elements in the detail field, my charts are going to be duplicated ( as many times as rows in the table of the database. i will have one page per row). And if i put them in summary i am loosing the page footer and page header

I don't know how to do it. I am using iReport 4.0.1.

Thanks and regards



Post Edited by mogador86 at 06/16/2011 14:20
mogador86's picture
Joined: Jun 16 2011 - 7:00am
Last seen: 7 years 11 months ago
0

SOLVED !!

There is an option in report inspector for showing summary with page header and page footer.

 

mogador86's picture
Joined: Jun 16 2011 - 7:00am
Last seen: 7 years 11 months ago
0
Try designing groups in your SQL query. In that way, you can display multiple graphs within each group footer in Ireport.

David
despec's picture
124
Joined: Jan 26 2010 - 11:45am
Last seen: 5 years 9 months ago
6

Other option is go to 'PRINT WHEN EXPRESSION' and put $V{REPORT_COUNT}==1 to avoid repeated values

adaliko's picture
69
Joined: Jan 28 2010 - 6:25am
Last seen: 6 years 3 months ago

Find 'PRINT WHEN EXPRESSION' property and put $V{REPORT_COUNT}==1 .. This function needs to apply for detail band to avoid repeated values.

kasunsageera - 4 years 11 months ago
0

I am also facing the same problem. I tried using $V{REPORT_COUNT}==1 into the PRINT WHEN Expression. But now my values are not repeated but still the number of pages generating are in thousands. The actual number should be 25. Can anybody help me with this?

skatariya's picture
Joined: Feb 11 2015 - 12:38pm
Last seen: 9 months 2 weeks ago
1

I find that if you add some kind of limit to your query it works. MySQL uses 'limit' and Oracle uses 'rownum <=1'. If you add this into your reports query (not your dataset query) then the table in the details band will not repeat.

dee211's picture
15
Joined: Apr 20 2015 - 1:28am
Last seen: 3 years 7 months ago
1

You just have to place your table into SUMMARY section of report instead of DETAIL section.

salnikov's picture
Joined: Nov 25 2015 - 4:02am
Last seen: 6 months 4 weeks ago
Feedback