Jump to content
We've recently updated our Privacy Statement, available here ×

How to condition Group and Subreport?


Recommended Posts

By: Sofiane - sofianito

How to condition Group and Subreport?

2002-12-12 04:47

Hi Teodor,

 

I'am using the trick that you provided in the doc to create various new pages using groups. My report has the following simplified structure:

 

<jasperReport>

 

<groupHeader n>

<band height="0"/>

</groupHeader n>

 

<groupHeader n-1>

<band height="0"/>

</groupHeader n-1>

.

.

<groupHeader 1>

<band height="0"/>

</groupHeader 1>

 

<detail>

<band height="100">

</band>

</detail>

 

<groupFooter 1>

<band height="20">

<subreport 1>

</subreport 1>

</band>

</groupFooter 1>

 

<groupFooter 2>

<band height="20">

<subreport 2>

</subreport 2>

</band>

</groupFooter 2>

.

.

<groupFooter n>

<band height="20">

<subreport n>

</subreport n>

</band>

</groupFooter n>

 

</jasperReport>

 

 

Here my needs : Depending on some conditions a subreport may not be printed ( I use printWhenExpression condition in subreport ). If it is not printed I want the group which embed that subreport to not be printed, is it possible and how ?

 

Thanks

Sofiane

 

 

By: Teodor Danciu - teodord

RE: How to condition Group and Subreport?

2002-12-12 05:02

 

Hi,

 

Use <printWhenExpression> at band level and not

element (subreport) level.

 

I hope this helps.

Teodor

 

 

 

By: Sofiane - sofianito

RE: How to condition Group and Subreport?

2002-12-12 06:21

It works fine...

 

Thanks

 

Sofiane

 

 

By: Sofiane - sofianito

RE: How to condition Group and Subreport?

2002-12-16 03:00

Hi Teodor,

 

CORRECTION: I tried it on two groups g1 and g2 respectively. When I set the printWhenExpression on g2 groupFooter to false and printWhenExpression on g1 group footer to true, it works perfectly. Here an excerpt :

 

<group name="g1">

<groupExpression>

$V{PAGE_NUMBER}

</groupExpression>

 

<groupHeader>

<band height="0">

</band>

</groupHeader>

 

<groupFooter>

<band height="545">

<printWhenExpression>

new Boolean( true )

</printWhenExpression>

</band>

</groupFooter>

</group>

 

<group name="g2">

<groupExpression>

$V{PAGE_NUMBER}

</groupExpression>

 

<groupHeader>

<band height="0">

</band>

</groupHeader>

 

<groupFooter>

<band height="545">

<printWhenExpression>

new Boolean( false )

</printWhenExpression>

</band>

</groupFooter>

</group>

 

<detail>

.

.

</detail>

 

When i reversed the values of printWhenExpression of the two group footers, The g2 group footer band replaced the g1 group footer band but i had a blank page at the end. I suppose that jasper report doesn't remove the outmost group footer band when its printWhenExpression value is false, is it a bug or am I totally wrong?

 

Thanks

Sofiane

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