Results 1 to 7 of 7

Thread: report header

  1. #1
    Join Date
    Jul 2009
    Posts
    7

    Unanswered: report header

    hi,

    I have a problem in heading of a report. I work with oracle 8i and report 6 in my office. In my report if it spreads to more than one page , i want to use the word continued from the second page till the last but one page and in the last page i want to use the world concluded.

    could anyone guide me as to how to use this . I am new to oracle and not very familiar with reports and forms

    thanks in advance

    ksjj

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I work with oracle 8i and report 6
    Both have been obsoleted this century & are no longer supported.
    Please join the 21st century whenever you are ready to do so.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    This is one way to do that; note that it works for a single user - if you are going to run this report in multi-user environment, you'll have to distinguish users by session ID or some other identifier.

    OK then, let's first create a table which will be used as a storage of total number of pages in this report:
    Code:
    SQL> create table rep_page_Num (page_num number);
    
    Table created.
    Next step is to create a field (in paper layout, outside of any frame). Let's call it "F_tp". Its source should be set to "Total Pages". Write its format trigger as follows (we don't really want to display it):
    Code:
    function F_tpFormatTrigger return boolean is
      l_page_num number;
    begin
      srw.get_page_num (l_page_num);
      insert into rep_page_num values (l_page_num);
      commit;
      return (FALSE);
    end;
    Now create two boilerplate objects; those will be strings representing values you've mentioned: "continued" and "concluded". I have put them one beside the other; you might put one above the other (so that they would be displayed on the same place). At the end, the layout should look like the image attached to this message.

    "continued" text should have such a format trigger: it fetches the maximum page number from the table we have created (here you'd use "session ID" or another identifier to distinguish different users who run this report, because each of them might (and probably will) have different number of "total pages"). "continued" will be displayed only if current page is different from total number of pages:
    Code:
    function B_3FormatTrigger return boolean is
     this_page   number;
     total_pages number;
    begin
     srw.get_page_num(this_page);
     select max(page_num) into total_pages from rep_page_num;
    
     if this_page = total_pages then
        return(FALSE);
     else
        return(TRUE);
     end if;
    end;
    "concluded" contains this code in its format trigger: it is the same as the previous field's trigger - the only difference is in RETURN clauses:
    Code:
    function B_4FormatTrigger return boolean is
     this_page   number;
     total_pages number;
    begin
     srw.get_page_num(this_page);
     select max(page_num) into total_pages from rep_page_num;
    
     if this_page = total_pages then
        return(TRUE);
     else
        return(FALSE);
     end if;
    end;
    That should be all ... once the report is run, "continued" is displayed on all pages but last; "concluded" is displayed only on the last page.

    Finally, you should delete records from the "rep_page_num" table.



    As of objection that certain products are obsolete or not, well, the same principle works in Reports Developer 10g as well as Oracle database 11g (the last versions published so far).

    Tables are created and being inserted in 11g just the same way they have been in Oracle 7 (the first version I remember, but I'm pretty sure that things didn't change much since Oracle 2). Fields are created the same way in Reports 6i and 10g, format triggers look the same, so ... 21st century really has nothing to do with the problem or the way it is to be solved. At least, not when someone uses this principle.
    Attached Thumbnails Attached Thumbnails dbf_last_page.PNG  

  4. #4
    Join Date
    Nov 2013
    Posts
    2
    I did... But format trigger working before other trigger


    Quote Originally Posted by Littlefoot View Post
    This is one way to do that; note that it works for a single user - if you are going to run this report in multi-user environment, you'll have to distinguish users by session ID or some other identifier.

    OK then, let's first create a table which will be used as a storage of total number of pages in this report:
    Code:
    SQL> create table rep_page_Num (page_num number);
    
    Table created.
    Next step is to create a field (in paper layout, outside of any frame). Let's call it "F_tp". Its source should be set to "Total Pages". Write its format trigger as follows (we don't really want to display it):
    Code:
    function F_tpFormatTrigger return boolean is
      l_page_num number;
    begin
      srw.get_page_num (l_page_num);
      insert into rep_page_num values (l_page_num);
      commit;
      return (FALSE);
    end;
    Now create two boilerplate objects; those will be strings representing values you've mentioned: "continued" and "concluded". I have put them one beside the other; you might put one above the other (so that they would be displayed on the same place). At the end, the layout should look like the image attached to this message.

    "continued" text should have such a format trigger: it fetches the maximum page number from the table we have created (here you'd use "session ID" or another identifier to distinguish different users who run this report, because each of them might (and probably will) have different number of "total pages"). "continued" will be displayed only if current page is different from total number of pages:
    Code:
    function B_3FormatTrigger return boolean is
     this_page   number;
     total_pages number;
    begin
     srw.get_page_num(this_page);
     select max(page_num) into total_pages from rep_page_num;
    
     if this_page = total_pages then
        return(FALSE);
     else
        return(TRUE);
     end if;
    end;
    "concluded" contains this code in its format trigger: it is the same as the previous field's trigger - the only difference is in RETURN clauses:
    Code:
    function B_4FormatTrigger return boolean is
     this_page   number;
     total_pages number;
    begin
     srw.get_page_num(this_page);
     select max(page_num) into total_pages from rep_page_num;
    
     if this_page = total_pages then
        return(TRUE);
     else
        return(FALSE);
     end if;
    end;
    That should be all ... once the report is run, "continued" is displayed on all pages but last; "concluded" is displayed only on the last page.

    Finally, you should delete records from the "rep_page_num" table.



    As of objection that certain products are obsolete or not, well, the same principle works in Reports Developer 10g as well as Oracle database 11g (the last versions published so far).

    Tables are created and being inserted in 11g just the same way they have been in Oracle 7 (the first version I remember, but I'm pretty sure that things didn't change much since Oracle 2). Fields are created the same way in Reports 6i and 10g, format triggers look the same, so ... 21st century really has nothing to do with the problem or the way it is to be solved. At least, not when someone uses this principle.

  5. #5
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Sorry, I don't understand what you are saying.

  6. #6
    Join Date
    Nov 2013
    Posts
    2
    Hi
    I want to find total page in format trigger. I create a field and this field source last page. Then write a format trigger this field :

    function F_11FormatTrigger return boolean is
    l_page_num number;
    begin
    srw.get_page_num(l_page_num);
    pkg_page_num.p_tpn := l_page_num;
    return (FALSE);
    END;

    Then I wrote a another field this field format trigger code:

    function F_9FormatTrigger return boolean is
    l_page_num number;
    begin
    srw.get_page_num(l_page_num);
    if l_page_num = pkg_page_num.p_tpn then
    return (FALSE);
    ELSE
    RETURN (TRUE);
    end if;

    end;

    ----------------------------------------------------------

    I want to do return false for f_9 field in last page... But f11 trigger working before f_9...




    Quote Originally Posted by Littlefoot View Post
    Sorry, I don't understand what you are saying.

  7. #7
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    You seem to be using a package here (instead of a table, as I did). OK then, have a look at my example on OraFAQ Forum (I don't feel like copying it over here).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •