Jump to content
Changes to the Jaspersoft community edition download ×

Dummy Groups problem


2004 IR Help

Recommended Posts

By: Jeff - jeffjeff

Dummy Groups problem

2005-04-19 14:02

Hi friends,

 

I use many dummy groups to display plan text in my report. However, I couldn't get it right so far.

 

I would like print my report with all data and then print the plain text in dummy group one and dummy group two.

 

It will look like

 

Report:

 

City Name City Code |

Dallas 123 | --> group with data

Fortworth 456 |

 

The city code is for ... --> dummy group one

 

The city name is for ... --> dummy group two

 

page 1 or 2 --> page footer

 

 

First I try to put data fields in detail session and define dummy groups without put fields inside. Like below:

 

<group name="GroupWithData">

<groupHeader>

<band height="35">

<staticText>

<reportElement x="0" y="0" width="30" height="30" mode="Opaque" />

<text>City:</text>

</staticText>

<staticText>

<reportElement x="35" y="0" width="30" height="30" mode="Opaque" />

<text>City Code:</text>

</staticText>

</band>

</groupHeader>

</group>

<group name="GroupDummyOne">

<groupHeader>

<band height="100">

<staticText>

<reportElement x="0" y="0" width="100" height="90" mode="Opaque" />

<text>This city code is for...</text>

</staticText>

</band>

</groupHeader>

</group>

<group name="GroupDummyTwo">

<groupHeader>

<band height="100">

<staticText>

<reportElement x="0" y="0" width="100" height="90" mode="Opaque" />

<text>This city name is for...</text>

</staticText>

</band>

</groupHeader>

</group>

<title>

</title>

<detail>

<band height="20">

<textField>

<reportElement x="0" y="0" width="30" height="15"/>

<textFieldExpression class="java.lang.String">

$F{cityName}

</textFieldExpression>

</textField>

<textField>

<reportElement x="0" y="35" width="30" height="15"/>

<textFieldExpression class="java.lang.String">

$F{cityCode}

</textFieldExpression>

</textField>

</band>

</detail>

<pageFooter>

</pageFooter>

 

My

In this way, all the data is printed in the end of the report. It looks like:

 

City Name City Code

 

The city code is for ...

 

The city name is for ...

Dallas 123

Fortworth 456

 

 

If I try to put the field into a groupHeader of another dummy group and keep detail session empty, and then only one row of data is printed.

 

The code looks like:

 

<group name="GroupForDataHeader">

<groupHeader>

<band height="35">

<staticText>

<reportElement x="0" y="0" width="30" height="30" mode="Opaque" />

<text>City:</text>

</staticText>

<staticText>

<reportElement x="35" y="0" width="30" height="30" mode="Opaque" />

<text>City Code:</text>

</staticText>

</band>

</groupHeader>

</group>

<group name="groupForDataItSelf">

<groupHeader>

<band height="20">

<textField>

<reportElement x="0" y="0" width="30" height="15"/>

<textFieldExpression class="java.lang.String">

$F{cityName}

</textFieldExpression>

</textField>

<textField>

<reportElement x="0" y="35" width="30" height="15"/>

<textFieldExpression class="java.lang.String">

$F{cityCode}

</textFieldExpression>

</textField>

</band>

</groupHeader>

</group>

<group name="GroupDummyOne">

<groupHeader>

<band height="100">

<staticText>

<reportElement x="0" y="0" width="100" height="90" mode="Opaque" />

<text>This city code is for...</text>

</staticText>

</band>

</groupHeader>

</group>

<group name="GroupDummyTwo">

<groupHeader>

<band height="100">

<staticText>

<reportElement x="0" y="0" width="100" height="90" mode="Opaque" />

<text>This city name is for...</text>

</staticText>

</band>

</groupHeader>

</group>

<title>

</title>

<detail>

(empty)

</detail>

<pageFooter>

</pageFooter>

 

The second record is missing. The result looks like:

 

City Name City Code

Dallas 123

 

The city code is for ...

 

The city name is for ...

 

page 1 or 2

 

 

I try to figure this for a week already and couldn't find any solution for it. Please help me out.

Thans a lot.

 

 

 

 

 

 

 

 

By: Paul Meshkovsky - meshpaul

RE: Dummy Groups problem

2005-04-20 07:20

I would say does City Names get Bigger. Fileds are not set to Streach. Data does not hava any data for some records? Do you use a tool like iReport or you use editor?

 

 

 

 

By: Jeff - jeffjeff

RE: Dummy Groups problem

2005-04-20 09:13

Hi meshpaul,

 

Thanks a lot for your help.

I am using intellij for coding.

I found a workaround this morning.

 

I am using the second method and put

 

<printWhenExpression><![CDATA[$V{REPORT_COUNT}.intValue() == $P{totalRowCount}.intValue() ? Boolean.TRUE : Boolean.FALSE]]>

 

in each dummy group.

 

In my java code, I get rowcount first, and pass (rowcount -1) as a parameter to xml file.

 

It solve my problem for now.

 

Thanks again.

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...