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 gram­mat­i­cal 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?













1















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










share|improve this question




























    1















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










    share|improve this question


























      1












      1








      1


      1






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










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 10:31









      Alex K

      18.6k1481166




      18.6k1481166










      asked Mar 8 at 7:08









      YogeendraYogeendra

      4818




      4818






















          1 Answer
          1






          active

          oldest

          votes


















          2














          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




          1. Add a parameter that is a java.util.Set (you can also use List, Map or other similar classes). Instance it with an empty HashSet.



            <parameter name="paramHack" class="java.util.Set">
            <defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
            </parameter>



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



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



          result




          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 both pageFooter and pageHeader. To clarify on last detail band page in pageFooter the $PparamHack.contains("detail_end") is true but $PparamHack.contains("summary") is false.




          Then in page header use this other flag to determine if to show or not show content.






          share|improve this answer

























          • 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











          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
          );



          );













          draft saved

          draft discarded


















          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









          2














          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




          1. Add a parameter that is a java.util.Set (you can also use List, Map or other similar classes). Instance it with an empty HashSet.



            <parameter name="paramHack" class="java.util.Set">
            <defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
            </parameter>



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



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



          result




          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 both pageFooter and pageHeader. To clarify on last detail band page in pageFooter the $PparamHack.contains("detail_end") is true but $PparamHack.contains("summary") is false.




          Then in page header use this other flag to determine if to show or not show content.






          share|improve this answer

























          • 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
















          2














          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




          1. Add a parameter that is a java.util.Set (you can also use List, Map or other similar classes). Instance it with an empty HashSet.



            <parameter name="paramHack" class="java.util.Set">
            <defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
            </parameter>



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



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



          result




          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 both pageFooter and pageHeader. To clarify on last detail band page in pageFooter the $PparamHack.contains("detail_end") is true but $PparamHack.contains("summary") is false.




          Then in page header use this other flag to determine if to show or not show content.






          share|improve this answer

























          • 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














          2












          2








          2







          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




          1. Add a parameter that is a java.util.Set (you can also use List, Map or other similar classes). Instance it with an empty HashSet.



            <parameter name="paramHack" class="java.util.Set">
            <defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
            </parameter>



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



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



          result




          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 both pageFooter and pageHeader. To clarify on last detail band page in pageFooter the $PparamHack.contains("detail_end") is true but $PparamHack.contains("summary") is false.




          Then in page header use this other flag to determine if to show or not show content.






          share|improve this answer















          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




          1. Add a parameter that is a java.util.Set (you can also use List, Map or other similar classes). Instance it with an empty HashSet.



            <parameter name="paramHack" class="java.util.Set">
            <defaultValueExpression><![CDATA[new java.util.HashSet()]]> </defaultValueExpression>
            </parameter>



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



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



          result




          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 both pageFooter and pageHeader. To clarify on last detail band page in pageFooter the $PparamHack.contains("detail_end") is true but $PparamHack.contains("summary") is false.




          Then in page header use this other flag to determine if to show or not show content.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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


















          • 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




















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived