Wednesday, January 23, 2013

Combined Running Page and Reset Page Numbers


I had a problem that a client wanted a report such that the page number in the header would reset every time there was a new order number.  At the same time, the client wanted a running page number on the footer.

This was tricky because it is easy to have one or the other but not both.  Hok Min (sp?) from Oracle Product Support provided me with a solution.  Here his the code he gave me:

 <fo:page-number xdofo:report-page-number="true"/>

The problem with using this code is that for it to work, it has to go in a form field.  This presents a problem because headers and footers cannot have form fields in an RTF template.  The work around is to define a subtemplate and to call the subtemplate from the footer.  Understand that subtemplates do not have to be on a separate RTF template but they can exist on the same RTF template.  When I do it this way, I usually put the definitions at the end of the RTF template that I am working on.

Here is the definition of the subtemplate:

<?template:pageno?>TotPageNo<?end template?>

The form field contains the code above in the blue text.

Now to use it in a footer:


--------------------------------------------------------------------------------------
footer section
                                            <?call:pageno?>


9 comments:

  1. Hi,

    Thanks a lot for your post. I have searched the solution for a long time ! It works for me and it's fine.
    But, I have another problem. I need to count all the pages of the report.
    Your solution gives me the current page but not the count. Have you the same problem in your report ? Have you any idea how to do this ?

    Thanks for your response,

    Maryse.

    ReplyDelete
    Replies
    1. I found the solution :
      I modify the FO Elements : fo:page-number-citation:xdofo:lastpage-joinseq
      to fo:page-number-citation ref-id="xdofo:lastpage-totalpg"
      and it works !

      Delete
    2. This comment has been removed by the author.

      Delete
    3. Thank you very much, this was most useful in Oracle BI Publisher by way of:

      Delete
    4. This comment has been removed by the author.

      Delete
  2. Thank you very much, this was most useful in Oracle BI Publisher by using the command fo:page-number-citation:xdofo:lastpage-totalpg

    ReplyDelete
  3. Thank you very much, this was most useful in Oracle BI Publisher by using the command fo:page-number-citation:xdofo:lastpage-totalpg

    ReplyDelete
  4. Thank you very much ..this post helps me really

    ReplyDelete
  5. hi , i have used your code ( subtemplate calling) . it return nothing. can you pls help .thanks.

    ReplyDelete