How can I know if jasper reports is evaluating the summary band?jasper report header not printed on summary pageHow to hide footer in subreport in jasperSummary band with Page Footer onlySummary with header and footer i-Report 5.0.1How to display the column footer before the summary band in jasper reprotsJasper Report 5.5 - Summary with Page header and footerDisplay different footer for jasper report summary sectionjasper report exclude summary page from PAGE NUMBERHow to make detail band height fixed in Jasper Report?How to get the summary band after last page footer band?
Generating adjacency matrices from isomorphic graphs
A Permanent Norse Presence in America
Has Darkwing Duck ever met Scrooge McDuck?
Can I use my Chinese passport to enter China after I acquired another citizenship?
How can "mimic phobia" be cured or prevented?
Is it possible to have a strip of cold climate in the middle of a planet?
Is there a word to describe the feeling of being transfixed out of horror?
Greatest common substring
Is camera lens focus an exact point or a range?
How to get the similar sounding words together
How to align and center standalone amsmath equations?
How do ground effect vehicles perform turns?
What linear sensor for a keyboard?
Freedom of speech and where it applies
Transformation of random variables and joint distributions
Why does Async/Await work properly when the loop is inside the async function and not the other way around?
Should I install hardwood flooring or cabinets first?
What is the grammatical term for “‑ed” words like these?
Confusion on Parallelogram
Can I Retrieve Email Addresses from BCC?
When quoting, must I also copy hyphens used to divide words that continue on the next line?
How to color a curve
Proving a function is onto where f(x)=|x|.
Do Legal Documents Require Signing In Standard Pen Colors?
How can I know if jasper reports is evaluating the summary band?
jasper report header not printed on summary pageHow to hide footer in subreport in jasperSummary band with Page Footer onlySummary with header and footer i-Report 5.0.1How to display the column footer before the summary band in jasper reprotsJasper Report 5.5 - Summary with Page header and footerDisplay different footer for jasper report summary sectionjasper report exclude summary page from PAGE NUMBERHow to make detail band height fixed in Jasper Report?How to get the summary band after last page footer band?
I have report footer with page number and a confidential disclaimer. I need to hide confidential disclaimer in summary pages but need page number as it is.
I have added isSummaryNewPage="true" and isSummaryWithPageHeaderAndFooter="true"
to the report.
Is there any flag to check whether the page is summary page or detail page inside <printWhenExpression> </printWhenExpression>
or <textFieldExpression> </textFieldExpression>
?
jasper-reports
add a comment |
I have report footer with page number and a confidential disclaimer. I need to hide confidential disclaimer in summary pages but need page number as it is.
I have added isSummaryNewPage="true" and isSummaryWithPageHeaderAndFooter="true"
to the report.
Is there any flag to check whether the page is summary page or detail page inside <printWhenExpression> </printWhenExpression>
or <textFieldExpression> </textFieldExpression>
?
jasper-reports
add a comment |
I have report footer with page number and a confidential disclaimer. I need to hide confidential disclaimer in summary pages but need page number as it is.
I have added isSummaryNewPage="true" and isSummaryWithPageHeaderAndFooter="true"
to the report.
Is there any flag to check whether the page is summary page or detail page inside <printWhenExpression> </printWhenExpression>
or <textFieldExpression> </textFieldExpression>
?
jasper-reports
I have report footer with page number and a confidential disclaimer. I need to hide confidential disclaimer in summary pages but need page number as it is.
I have added isSummaryNewPage="true" and isSummaryWithPageHeaderAndFooter="true"
to the report.
Is there any flag to check whether the page is summary page or detail page inside <printWhenExpression> </printWhenExpression>
or <textFieldExpression> </textFieldExpression>
?
jasper-reports
jasper-reports
edited Mar 8 at 10:31
Alex K
18.6k1481166
18.6k1481166
asked Mar 8 at 7:08
YogeendraYogeendra
4818
4818
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
AFIK There is no built in property that tells you that you are on summary band.
However, I think this is a case where you safely can use what I call the "parameter hack" solution if summary band is on multiple page or for any another reason you don't like to use the lastPageFooter
band.
The parameter hack solution
Add a parameter that is a
java.util.Set
(you can also useList
,Map
or other similar classes). Instance it with an emptyHashSet
.<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
</parameter>In a textField (in your case first on summary band), add a key to it in
printWhenExpression
, be careful the expression can be evaluated more then one time so always make sure it returns true.<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
You can now use
$PparamHack.contains("summary")
to know if the textField has been evaluated, hence in case to know if we have arrived to summary band and not print the "confidential disclaimer".<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
Example
jrxml
<?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 http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="WhenSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" uuid="bbec9a5c-d9fc-4e29-b2b0-cea6d7a50394">
<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="40">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="74f6c3de-9867-4895-b7bb-c9cdb124fbdc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[First just an empty page]]></text>
</staticText>
</band>
</detail>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="50" y="0" width="440" height="40" uuid="af5f6f4c-fe77-4f07-a080-035230123f50">
<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<textFieldExpression><![CDATA["Confidential"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="493" y="0" width="60" height="40" uuid="78b7b8bd-4189-42ea-8120-5a09a8b5701c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="22"/>
</textElement>
<textFieldExpression><![CDATA[$VPAGE_NUMBER]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="40" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="9ee45216-e7e1-4e5a-bbed-1f057ade1967">
<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[Summary page]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Output
If you also like to use this solution for summary pageHeader
(that starts before summary, but after detail band) you can for example add a "fake" group and in the group footer band (that is evaluated after detail band, but before page header on summary band) add another property to our paramHack
parameter detail_end
.
<group name="FakeGroup">
<groupExpression><![CDATA["dummy"]]></groupExpression>
<groupFooter>
<band height="1">
<textField>
<reportElement x="0" y="0" width="553" height="1" uuid="373fc74e-011a-4f03-9cd4-9d5d9464ab06">
<printWhenExpression><![CDATA[$PparamHack.add("detail_end") && false]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA["Hidden used just to know when detail band ends"]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
Note: I have used another name, since this will be set before
pageFooter
on last detail band page, hence you can't use same name of flag for bothpageFooter
andpageHeader
. To clarify on last detail band page inpageFooter
the$PparamHack.contains("detail_end")
istrue
but$PparamHack.contains("summary")
isfalse
.
Then in page header use this other flag to determine if to show or not show content.
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058354%2fhow-can-i-know-if-jasper-reports-is-evaluating-the-summary-band%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
AFIK There is no built in property that tells you that you are on summary band.
However, I think this is a case where you safely can use what I call the "parameter hack" solution if summary band is on multiple page or for any another reason you don't like to use the lastPageFooter
band.
The parameter hack solution
Add a parameter that is a
java.util.Set
(you can also useList
,Map
or other similar classes). Instance it with an emptyHashSet
.<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
</parameter>In a textField (in your case first on summary band), add a key to it in
printWhenExpression
, be careful the expression can be evaluated more then one time so always make sure it returns true.<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
You can now use
$PparamHack.contains("summary")
to know if the textField has been evaluated, hence in case to know if we have arrived to summary band and not print the "confidential disclaimer".<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
Example
jrxml
<?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 http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="WhenSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" uuid="bbec9a5c-d9fc-4e29-b2b0-cea6d7a50394">
<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="40">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="74f6c3de-9867-4895-b7bb-c9cdb124fbdc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[First just an empty page]]></text>
</staticText>
</band>
</detail>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="50" y="0" width="440" height="40" uuid="af5f6f4c-fe77-4f07-a080-035230123f50">
<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<textFieldExpression><![CDATA["Confidential"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="493" y="0" width="60" height="40" uuid="78b7b8bd-4189-42ea-8120-5a09a8b5701c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="22"/>
</textElement>
<textFieldExpression><![CDATA[$VPAGE_NUMBER]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="40" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="9ee45216-e7e1-4e5a-bbed-1f057ade1967">
<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[Summary page]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Output
If you also like to use this solution for summary pageHeader
(that starts before summary, but after detail band) you can for example add a "fake" group and in the group footer band (that is evaluated after detail band, but before page header on summary band) add another property to our paramHack
parameter detail_end
.
<group name="FakeGroup">
<groupExpression><![CDATA["dummy"]]></groupExpression>
<groupFooter>
<band height="1">
<textField>
<reportElement x="0" y="0" width="553" height="1" uuid="373fc74e-011a-4f03-9cd4-9d5d9464ab06">
<printWhenExpression><![CDATA[$PparamHack.add("detail_end") && false]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA["Hidden used just to know when detail band ends"]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
Note: I have used another name, since this will be set before
pageFooter
on last detail band page, hence you can't use same name of flag for bothpageFooter
andpageHeader
. To clarify on last detail band page inpageFooter
the$PparamHack.contains("detail_end")
istrue
but$PparamHack.contains("summary")
isfalse
.
Then in page header use this other flag to determine if to show or not show content.
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
add a comment |
AFIK There is no built in property that tells you that you are on summary band.
However, I think this is a case where you safely can use what I call the "parameter hack" solution if summary band is on multiple page or for any another reason you don't like to use the lastPageFooter
band.
The parameter hack solution
Add a parameter that is a
java.util.Set
(you can also useList
,Map
or other similar classes). Instance it with an emptyHashSet
.<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
</parameter>In a textField (in your case first on summary band), add a key to it in
printWhenExpression
, be careful the expression can be evaluated more then one time so always make sure it returns true.<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
You can now use
$PparamHack.contains("summary")
to know if the textField has been evaluated, hence in case to know if we have arrived to summary band and not print the "confidential disclaimer".<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
Example
jrxml
<?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 http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="WhenSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" uuid="bbec9a5c-d9fc-4e29-b2b0-cea6d7a50394">
<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="40">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="74f6c3de-9867-4895-b7bb-c9cdb124fbdc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[First just an empty page]]></text>
</staticText>
</band>
</detail>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="50" y="0" width="440" height="40" uuid="af5f6f4c-fe77-4f07-a080-035230123f50">
<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<textFieldExpression><![CDATA["Confidential"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="493" y="0" width="60" height="40" uuid="78b7b8bd-4189-42ea-8120-5a09a8b5701c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="22"/>
</textElement>
<textFieldExpression><![CDATA[$VPAGE_NUMBER]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="40" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="9ee45216-e7e1-4e5a-bbed-1f057ade1967">
<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[Summary page]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Output
If you also like to use this solution for summary pageHeader
(that starts before summary, but after detail band) you can for example add a "fake" group and in the group footer band (that is evaluated after detail band, but before page header on summary band) add another property to our paramHack
parameter detail_end
.
<group name="FakeGroup">
<groupExpression><![CDATA["dummy"]]></groupExpression>
<groupFooter>
<band height="1">
<textField>
<reportElement x="0" y="0" width="553" height="1" uuid="373fc74e-011a-4f03-9cd4-9d5d9464ab06">
<printWhenExpression><![CDATA[$PparamHack.add("detail_end") && false]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA["Hidden used just to know when detail band ends"]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
Note: I have used another name, since this will be set before
pageFooter
on last detail band page, hence you can't use same name of flag for bothpageFooter
andpageHeader
. To clarify on last detail band page inpageFooter
the$PparamHack.contains("detail_end")
istrue
but$PparamHack.contains("summary")
isfalse
.
Then in page header use this other flag to determine if to show or not show content.
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
add a comment |
AFIK There is no built in property that tells you that you are on summary band.
However, I think this is a case where you safely can use what I call the "parameter hack" solution if summary band is on multiple page or for any another reason you don't like to use the lastPageFooter
band.
The parameter hack solution
Add a parameter that is a
java.util.Set
(you can also useList
,Map
or other similar classes). Instance it with an emptyHashSet
.<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
</parameter>In a textField (in your case first on summary band), add a key to it in
printWhenExpression
, be careful the expression can be evaluated more then one time so always make sure it returns true.<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
You can now use
$PparamHack.contains("summary")
to know if the textField has been evaluated, hence in case to know if we have arrived to summary band and not print the "confidential disclaimer".<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
Example
jrxml
<?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 http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="WhenSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" uuid="bbec9a5c-d9fc-4e29-b2b0-cea6d7a50394">
<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="40">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="74f6c3de-9867-4895-b7bb-c9cdb124fbdc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[First just an empty page]]></text>
</staticText>
</band>
</detail>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="50" y="0" width="440" height="40" uuid="af5f6f4c-fe77-4f07-a080-035230123f50">
<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<textFieldExpression><![CDATA["Confidential"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="493" y="0" width="60" height="40" uuid="78b7b8bd-4189-42ea-8120-5a09a8b5701c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="22"/>
</textElement>
<textFieldExpression><![CDATA[$VPAGE_NUMBER]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="40" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="9ee45216-e7e1-4e5a-bbed-1f057ade1967">
<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[Summary page]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Output
If you also like to use this solution for summary pageHeader
(that starts before summary, but after detail band) you can for example add a "fake" group and in the group footer band (that is evaluated after detail band, but before page header on summary band) add another property to our paramHack
parameter detail_end
.
<group name="FakeGroup">
<groupExpression><![CDATA["dummy"]]></groupExpression>
<groupFooter>
<band height="1">
<textField>
<reportElement x="0" y="0" width="553" height="1" uuid="373fc74e-011a-4f03-9cd4-9d5d9464ab06">
<printWhenExpression><![CDATA[$PparamHack.add("detail_end") && false]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA["Hidden used just to know when detail band ends"]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
Note: I have used another name, since this will be set before
pageFooter
on last detail band page, hence you can't use same name of flag for bothpageFooter
andpageHeader
. To clarify on last detail band page inpageFooter
the$PparamHack.contains("detail_end")
istrue
but$PparamHack.contains("summary")
isfalse
.
Then in page header use this other flag to determine if to show or not show content.
AFIK There is no built in property that tells you that you are on summary band.
However, I think this is a case where you safely can use what I call the "parameter hack" solution if summary band is on multiple page or for any another reason you don't like to use the lastPageFooter
band.
The parameter hack solution
Add a parameter that is a
java.util.Set
(you can also useList
,Map
or other similar classes). Instance it with an emptyHashSet
.<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
</parameter>In a textField (in your case first on summary band), add a key to it in
printWhenExpression
, be careful the expression can be evaluated more then one time so always make sure it returns true.<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
You can now use
$PparamHack.contains("summary")
to know if the textField has been evaluated, hence in case to know if we have arrived to summary band and not print the "confidential disclaimer".<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
Example
jrxml
<?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 http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="WhenSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" uuid="bbec9a5c-d9fc-4e29-b2b0-cea6d7a50394">
<parameter name="paramHack" class="java.util.Set">
<defaultValueExpression><![CDATA[new java.util.HashSet()]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<detail>
<band height="40">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="74f6c3de-9867-4895-b7bb-c9cdb124fbdc"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[First just an empty page]]></text>
</staticText>
</band>
</detail>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="50" y="0" width="440" height="40" uuid="af5f6f4c-fe77-4f07-a080-035230123f50">
<printWhenExpression><![CDATA[!$PparamHack.contains("summary")]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<textFieldExpression><![CDATA["Confidential"]]></textFieldExpression>
</textField>
<textField>
<reportElement x="493" y="0" width="60" height="40" uuid="78b7b8bd-4189-42ea-8120-5a09a8b5701c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="22"/>
</textElement>
<textFieldExpression><![CDATA[$VPAGE_NUMBER]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="40" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="545" height="40" uuid="9ee45216-e7e1-4e5a-bbed-1f057ade1967">
<printWhenExpression><![CDATA[$PparamHack.add("summary") || true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="26"/>
</textElement>
<text><![CDATA[Summary page]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Output
If you also like to use this solution for summary pageHeader
(that starts before summary, but after detail band) you can for example add a "fake" group and in the group footer band (that is evaluated after detail band, but before page header on summary band) add another property to our paramHack
parameter detail_end
.
<group name="FakeGroup">
<groupExpression><![CDATA["dummy"]]></groupExpression>
<groupFooter>
<band height="1">
<textField>
<reportElement x="0" y="0" width="553" height="1" uuid="373fc74e-011a-4f03-9cd4-9d5d9464ab06">
<printWhenExpression><![CDATA[$PparamHack.add("detail_end") && false]]></printWhenExpression>
</reportElement>
<textFieldExpression><![CDATA["Hidden used just to know when detail band ends"]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
Note: I have used another name, since this will be set before
pageFooter
on last detail band page, hence you can't use same name of flag for bothpageFooter
andpageHeader
. To clarify on last detail band page inpageFooter
the$PparamHack.contains("detail_end")
istrue
but$PparamHack.contains("summary")
isfalse
.
Then in page header use this other flag to determine if to show or not show content.
edited Mar 14 at 9:02
answered Mar 8 at 8:36
Petter FribergPetter Friberg
16.3k83975
16.3k83975
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
add a comment |
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
It worked for footer, but technique is not working for header content. Please help.I have multiple page summary. First page it is showing the content and the rest it is hidden.
– Yogeendra
Mar 14 at 7:57
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
@Yogeendra I have updated post, you use a similar method but with a new flag, on way is to use a fake group, the groupFooter band will be evaluated before pageHeader on summary band, but note you need another flag (hence another name), since it is evaluated before page footer on last detail band page ;)
– Petter Friberg
Mar 14 at 8:52
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058354%2fhow-can-i-know-if-jasper-reports-is-evaluating-the-summary-band%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown