6 Replies Latest reply: Oct 24, 2007 11:39 AM by Keith Jamieson RSS

    APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or footer

    568487
      hello.

      I want to put a variable ( like :P15_MY_PARAMETER) in the header OR footer of a standard PDF report , but does'nt work.

      I tried HTML formating with ' &P15_MY_PARAMETER. ' like described in the thread Include a display value in HTML footer ( Include a display value in HTML footer )
      but PDF generated is not readeable by Adobe, , I suppose html codin was not translated.

      Is it a possibility to put a variable in a PDF header / footer.?

      Thanks

      Fernand Ducarme
        • 1. Re: APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or fo
          Marc Sewtz
          Fernand,

          Yes, that is possible. You can use the &ITEM_NAME. syntax. Your item value should not include HTML tags though. And it should already be set in session state.

          Regards,
          Marc
          • 2. Re: APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or fo
            568487
            DOOOhhhh !! It's SOOO Simple!
            and it works!
            Thanks a LOT!
            • 3. Re: APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or fo
              Keith Jamieson
              I am trying to set a variable in a PDF Header.
              If I use &APP_USER. the user is dispalyed correctly

              However I am trying to set the value from a text item.

              My Item is called P1_TEST
              It is set to Text field Disabled (Saves State)
              I have set both the source value and the default value to "test item in header"

              I am using &P1_TEST. in the PDF Header

              I'm using Apex 3.0.1 on XE running ApacheFop/O4J

              I suspect I have a state issue. Anyone point me where I'm going wrong. Thanks
              • 4. Re: APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or fo
                Keith Jamieson
                Well from reading around, it looks like we need to use application level items.
                So I created an application level item for todays date and that worked perfectly, except the 7 in 2007 appeared to be subscripted!

                What I'm looking for is to use page level items so that I can have for example the report name in the header.

                Surely, it must be possible to put a page item into a header or footer.

                OK Found the problem
                ========================
                Ah Ok. The page apparently needs to be submitted to pick up the item values in the PDF header/footer.

                But Can I pick up the items without submitting the page???

                Message was edited by:
                Keith Jamieson
                • 5. Re: APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or fo
                  Marc Sewtz
                  Keith,

                  If you want to use the value of page items in your PDF page header or footer, they need to be written to session state first. In order to do this, your form needs to be submitted. So a button that redirects to a URL or a report print links (that also redirects), won't do that. But submitting your form doesn't necessarily mean you'll have to leave or refresh your current page. All you would have to do is create a branch that points to your PDF document, and make that the target of your submit action. This way, your page doesn't refresh, and you'll get the open/save PDF dialog you would expect.

                  So to give you an example, if you have a regular reports region, enable PDF printing, but do not specify a link label. Then create your own print button, which needs to be a submit button (not redirect to URL). And then create a branch to the current page that is executed when pressing your print button. That branch also needs this request:

                  FLOW_XMLP_OUTPUT_R[Report Region ID]

                  so if your report region ID is 90104803966374878, then the request would be:

                  FLOW_XMLP_OUTPUT_R90104803966374878

                  The same technique works for report queries, only in that case you would point to page 0 and use this request:

                  PRINT_REPORT=[your report query name]

                  So if your report query name is "myreport", this would be

                  PRINT_REPORT=myreport

                  Hope this helps,

                  Regards,
                  Marc
                  • 6. Re: APEX 3.0 PDF FOP OC4J REPORT: how to put a variable in the header or fo
                    Keith Jamieson
                    Thanks Marc. I tried this out and it works quite well. I had to use the apex_views to get the Region_id but hey, thats what they are there for