Jump to content
Changes to the Jaspersoft community edition download ×

Aaaaarggghh !!! Sub reports dont show up !!


2005 IR Help

Recommended Posts

By: Juby Victor - jubyvictor

Aaaaarggghh !!! Sub reports dont show up !!

2004-10-12 04:09

Hi ppl,

i'm using jasper0.6.0 & ireports 0.3.2. somehow, the subreports just dont show up .. plz help.. i am just trying to print a static text field from my sub report..

 

Heres the src

 

First the master

============

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="Master"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="2" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="3" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="3" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="44"

y="15"

width="331"

height="60"

forecolor="#000000"

backcolor="#FFFFFF"

key="subreport-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<subreportExpression class="java.lang.String"><![CDATA["E:/Sub.jasper"]]></subreportExpression>

</subreport>

</band>

</detail>

<columnFooter>

<band height="2" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="2" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

 

 

Now the Child

===========

 

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="Sub"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="0" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="3" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="2" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Opaque"

x="73"

y="19"

width="393"

height="26"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[i'm the sub report !]]></text>

</staticText>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="1" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

 

 

 

 

 

 

 

 

By: Tobias Gaekle - ike987

RE: Aaaaarggghh !!! Sub reports dont show up

2004-10-12 04:46

the detail section will never show because you have no data rows to iterate over. put your text in a different band (eg. page header) and set the attribute whenNoDataType="AllSectionsNoDetail" in the <jasperReport>-Tag. do this for both your main and subreport.

 

 

 

 

By: Juby Victor - jubyvictor

:) :) it works !!

2004-10-12 04:55

Hi man thanx a lot it works..

however now i'll try to have a report that runs queries / data sources hope it will work :).. will get back after trying those also

 

 

 

 

By: Juby Victor - jubyvictor

Help needed with the query !

2004-10-12 05:21

Can u please correct my query ?

 

In master report the query is ...

 

select lastName from person_dets where firstName like '%sam%'

 

In sub report the query is

 

select firstName from person_dets where lastname like $P{LASTNAME} or is it $F{} .

 

i've added lastname as a subreport param in the main report and also added LASTNAME as a param in the sub report.. but i dont see any result.

 

 

.. where the hell are these details documented ? Are they hidden so that ppl hang around all time in the help forum ?!!!

 

 

 

 

 

 

 

By: Tobias Gaekle - ike987

RE: Help needed with the query !

2004-10-12 06:45

there's lots of info on the jasperreports homepage, and especially the examples that come with it. you can also buy an ebook documentation for a small fee.

 

add an exclamation mark when dereferencing parameters in the query, so your query should probably read:

 

select firstName from person_dets where lastname like '$P!{LASTNAME}'

 

 

 

 

By: Juby Victor - jubyvictor

RE: Aaaaarggghh !!! Sub reports dont show up

2004-10-13 00:31

No ! it doesnt run the query to get the results..

$F{FIRSTNAME} prints null.

on the smae page $P{LASTNAME} prints values, which means that the value is being passed...

 

can u give a simple example ? plz mail it to

jubygetsmail@yahoo.co.in

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...