How can I not print a Sub Report?

0
By: Todd - mrtodds
How can I not print a Sub Report?
2004-05-05 09:39
OK, I got my master page working and I created four groups that print on a new page, and I can print and all five will print. But I need to not print some of the pages based on certain logic. How can I not print a sub-report defined from a group?

I tried setting the group expression, but no matter what I set it to it still prints the page or a blank page.

How can I completely turn one of them off?




By: Todd - mrtodds
RE: How can I not print a Sub Report?
2004-05-05 11:19
Using the Sub-Report "Print When Expression" I can control if the sub-report gets called or not.

But still the group band is defined and I get a blank page. If I set the group band height to 0, I get a compile warning, but the page doesn't print. YEA.

But there doesn't seem to be a way to dynamically pass the group band height.

Any Help?




By: C-Box - c-box
RE: How can I not print a Sub Report?
2004-05-06 03:34
Doesn't work the "PrintWhenExpression" of your GroupHeader/GroupFooter Section(s)???

Just put the same expression you use for hiding your SubReport into your band-objects you want to hide.

I also managed not printing ColumnHeader on first page with the PrintWhenExpression of the ColumnHeaderBand-Object.

hth
C-Box




By: Todd - mrtodds
RE: How can I not print a Sub Report?
2004-05-06 08:44
c-box,

Thank you for your response.

I have tried everything. I am using Jasper 5.0, using iReports 0.2.2 as my designer.

When I put in "new Boolean("FALSE")" into my PRINTWHENEXPRESSION for supressing the sub-report it doesn't run the sub-report but still a blank page prints. If I set the same expression above in the GROUPEXPRESSION of the group, it seems to have no affect. In fact nothing I set in the GROUPEXPRESSION to seems to have any effect. If I leave it blank or null, it still prints.

Am I missing something. Is there an expression I can test for on the group expression that will always supress the page?




By: Chuck Deal - cdeal
RE: How can I not print a Sub Report?
2004-05-06 10:13
Not the Groups's GROUPEXPRESSION, the Group's PRINTWHENEXPRESSION.




By: Todd - mrtodds
RE: How can I not print a Sub Report?
2004-05-06 13:31
When I call a subreport from my group I see a PRINTWHENEXPRESSION, but that is only for the subreport. Does the group also have another PRINTWHENEXPRESSION OUTSIDE THE SUBREPORT?

Here is a little snap of my code:

<group name="PAGE_2" isStartNewColumn="false" isStartNewPage="true" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" >
<groupExpression><![CDATA[new Boolean($F{TEXT_02}.equals("N"))]]></groupExpression>
<groupHeader>
<band height="0" isSplitAllowed="true" >
</band>
</groupHeader>
<groupFooter>
<band height="120" isSplitAllowed="true" >
<subreport isUsingCache="true">
<reportElement
mode="Opaque"
x="0"
y="0"
width="610"
height="120"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="true"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[new Boolean($F{TEXT_02}.equals("N"))]]></printWhenExpression>
</reportElement>
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP} ]]></parametersMapExpression>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{IMAGE_PATH} + "xml/Form_9_p2_Master.jasper"]]></subreportExpression>
</subreport>
</band>
</groupFooter>
</group>





By: C-Box - c-box
RE: How can I not print a Sub Report?
2004-05-06 22:42
of course the bands also have a "PrintWhenExpression"...

your code should be:

<group name="PAGE_2" isStartNewColumn="false" isStartNewPage="true" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" >
<groupExpression><![CDATA[new Boolean($F{TEXT_02}.equals("N"))]]></groupExpression>
<groupHeader>
<band height="0" isSplitAllowed="true" >
<printWhenExpression><![CDATA[new Boolean($F{TEXT_02}.equals("N"))]]></printWhenExpression>
</band>
</groupHeader>
<groupFooter>
<band height="120" isSplitAllowed="true" >
<printWhenExpression><![CDATA[new Boolean($F{TEXT_02}.equals("N"))]]></printWhenExpression>
<subreport isUsingCache="true">
<reportElement
mode="Opaque"
x="0"
y="0"
width="610"
height="120"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="true"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[new Boolean($F{TEXT_02}.equals("N"))]]></printWhenExpression>
</reportElement>
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP} ]]></parametersMapExpression>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{IMAGE_PATH} + "xml/Form_9_p2_Master.jasper"]]></subreportExpression>
</subreport>
</band>
</groupFooter>
</group>

If you are using iReport (current version) then you can easily edit the "PrintWhenExpression" of bands over GUI.


hth
C-Box





By: Chuck Deal - cdeal
RE: How can I not print a Sub Report?
2004-05-07 05:08
Sorry, you're right, the Band has a PrintWhenExpression, not the group.

There is a wealth of information available at the jasperReports website. Sometimes it is helpful to check there when syntax questions come up. For example, here is a quick reference page that could have help you find your answer: http://jasperreports.sourceforge.net/quick.reference.html




By: Todd - mrtodds
RE: How can I not print a Sub Report?
2004-05-10 12:08
OK, COOL. That fixed it. I can't believe I over looked the Band Print When Expression in Ireports for so long. I must've looked at the screen 1000 times trying to solve this problem.

Thanks!
2005 IR Help's picture
Joined: Aug 9 2006 - 3:40am
Last seen: 8 years 3 weeks ago

Answers:

No answers yet
Feedback
randomness