TOTAL PAGES

Dicas e truques sobre Oracle Reports Builder - modo gráfico ou modo caractere, ascii, arquivo .PRT, etc
  

Poston Mon, 29 Aug 2005 3:48 pm

ALL RIGHT GUYS!!!!


I WOULD LIKE TO KNOW HOW I CAN GET INTO A FORMULA COLUMN THE VALUE OF THE TOTAL NUMBER OF PAGES OF THE REPORT.


RICARDO
ralmeida
Location: Assis/SP

Poston Mon, 29 Aug 2005 4:01 pm

Creates a boilerplace and put the following text in it:
Code: Select all
Página &<PageNumber> de &<TotalPages>
another way is you create a FIELD and choose the source he \"phisical Total Pages\"
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Mon, 29 Aug 2005 4:12 pm

DEAR DR. GORI ...

I NEED TO BRING THE VALUE OF THE TOTAL NUMBER OF PAGES IN THE FORMULA COLUMN AS IT WILL PERFORM CALCULATIONS WITH THIS VALUE.

RICARDO
ralmeida
Location: Assis/SP

Poston Mon, 29 Aug 2005 4:22 pm

Take a look at this topic ... viewtopic.php?t=550 the guy did something like that.
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Mon, 29 Aug 2005 4:32 pm

IT CANNOT HELP ME!!!!

Because the report is RECORDED in MICROFILM TAX BOOK where EACH MICROFILM RECEIVES 175 PAGES, WILL REPORT SOON on the OPENING TERM the amount of PAGES and the number of MICROFILM = (TOTAL PAGES/175).



RICARDO
ralmeida
Location: Assis/SP

Poston Tue, 30 Aug 2005 11:08 am

Actually, this tip above doesn't help, because you need to retrieve the TOT PAGE NUM.

I found a post on metalink. I tested it and it worked!

Code: Select all
Doc ID:    Note:130432.1
Subject:    HOW TO PRINT THE REPORT TOTAL PAGES ONLY AT THE LAST PAGE
Type:    BULLETIN
Status:    PUBLISHED
   
Content Type:    TEXT/X-HTML
Creation Date:    11-DEC-2000
Last Revision Date:    05-DEC-2001


SCOPE & APPLICATION
-------------------
This document gives a workaround to get the report total pages number
and use it, in the format trigger of a field so that will be printed
ONLY at the last page of the report.

The problem is that you cannot refer to a field with source total_pages   
in the format trigger of another field without getting the error 'REP-730
The following bind variable is not defined', and also there is not any build
in function (like srw.get_page_num) to calculate the report total pages.     



HOW TO PRINT REPORT TOTAL PAGES AT LAST PAGE
--------------------------------------------

1. Add in the report 2 fields :  total_pages with source 'Total Pages' and
page_num with source 'Page Number'.
2. Create in the database a table page_num  to store the number of pages of the
report.  You can also add in this table another column to store the session id
in order to insert the page numbers with a unique identifier
for this report instance and be able to use this technique for multiple reports.
The description of the table page_num will be:
Name                            Type
------------------------------- ----
SESSION_ID                      NUMBER(10)
PAGE_NUM                        NUMBER(10)

(You can also use a local package variable to store the page number instead of
inserting it in a database table).

In the format trigger of the field total_pages write the following code in order
to get the total pages of the report and insert this number in a table:     

function total_pagesFormatTrigger return boolean is                           
  page_num number;                                                             
  a number(3);                                                                 
begin                                                                           
  srw.get_page_num (page_num);                             
  a:= page_num;
  insert into page_num values(global.session_id,a);
  commit;                                                                                                                       
  return (TRUE);                                                               
end;   

global.session_id comes from a package variable you have previously created in
order to get the session id.

The package specification and body is as follows:
PACKAGE global IS
        session_id number(10) ;
END;

PACKAGE BODY global IS
begin
select  sid
into    session_id
from    v$session
where   audsid = userenv('sessionid') ;
END;
                                                                 
In the format trigger of the page_num field write the following code in order to   
retrieve the total pages from the database, compare it with the current page     
and print it if current page is equal to the last page:                               

function page_numFormatTrigger return boolean is                                   
  this_page number;                                                             
  a number;                                                                     
  b number;                                                                     
begin                                                                           
  srw.get_page_num(this_page);                                                 
  a := this_page;
  select max(page_num) into b from page_num
  where session_id = global.session_id;                                                               
  if a = b then                                                                 
    return(TRUE);                                                             
  else                                                                         
    return(FALSE);                                                               
  end if;                                                                       
end;

Finally delete the records in the page_num table after the report ends
in the After Report Trigger:
function AfterReport return boolean is
begin
  srw.do_sql('delete from page_num where session_id = ' || to_char(global.session_id));
  srw.do_sql('commit');
return (TRUE);
end;


dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Wed, 31 Aug 2005 8:25 am

DEAR DR. GORI I RAN SOME TESTS WITH THIS CODE AND STILL A GOT A SOLUTION .... The big problem is that I HAVE to GET on the front page of the REPORT the TOTAL_PAGES/175.




RICARDO
ralmeida
Location: Assis/SP

Poston Wed, 31 Aug 2005 10:16 am

With this hint above, you can find out the number of total pages, applying the
Code: Select all
select max(page_num) into b from page_num
  where session_id = global.session_id;
to put this value in the home, simply you place this code above within a PL/SQL block of a FIELD any and then goes to show the value of b in the field:
Code: Select all
srw.set_field(0, b);
IE, vada time field appear on the screenHe'll get MAX and show in the country!

Try this!
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Wed, 31 Aug 2005 10:45 am

I MANAGED TO GET A SOLUTION ... ...


I JUST HAD TO MAKE SEVERAL CHANGES IN THIS CODE ...
THANK YOU VERY MUCH FOR THE TIP ...:!::!::!::D



RICARDO
ralmeida
Location: Assis/SP

Poston Wed, 31 Aug 2005 10:49 am

Well, if you don't mind, have as you put in there what you did?
(type, hence the hint to anyone else) valeu
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Tue, 18 Jul 2006 9:51 am

But dr_gori, I applied this example, he even returns the correct value, but only on the last page. I need this value to be shown on all pages. Just that, when he entered the last value in the table (the one on the actual last page), he \"created\" the page. How to make so that the value of the last page to appear in all of them? Would it be possible? I'm killing myself here and I can't get anywhere.
I wanted something like this: 1 Page, displays: 01/ 175 Page 2 displays: 02/ 175 Page 3 displays: 03/ 175 remembering that this hypothetical value 175 I can with some calculations involving the previous process (insert into page_num values (global. session_id, a);), so I can't use Total_Logical_Pages & simply.

Is there anything that can be done?
Toad
Location: Seattle, WA

Matheus H. Gonçalves
www.toad.com.br
www.twitter.com/toadgeek

Poston Tue, 24 Oct 2006 10:22 am

Good day, the tip to get the number of the last page, just that I needed to pass this number in words in a book I'm doing tax, since already thank you.

sincerely Eli.
passageiromr
Location: Santa Cruz do Rio Pardo

Poston Tue, 24 Oct 2006 11:00 am

Take a peek on this topic: viewtopic.php?t=36&highlight=extenso
Toad
Location: Seattle, WA

Matheus H. Gonçalves
www.toad.com.br
www.twitter.com/toadgeek

Poston Thu, 29 Oct 2009 3:46 pm

I'm having the same problem of ricardo can someone help me, to obtain the total number of pages on the front page by changing the homepage?
Rafael.Steil
Location: Sapiranga

Poston Tue, 03 Nov 2009 4:37 pm

I just got this by placing 2 << Field >> in Body.

I double click on the first and on the tab Object in Source > From: I selected the << option & Logical Page Number >> representing the current page .

In the second << Field >> I did the same procedure, but the option selected was << & Logical Pages Total >> representing the Total pages generated.

1 page, 1/5 displays: Page 2, Page 2/5 displays: 3, displays: 3/5 SUCCESS!!!

It didn't require any programming, and this was done in the Reports 2.5 here in the company.
JOPA
Location: Salvador - BA

Atenciosamente,

João Paulo A. C. do Bomfim

"Deu certo? Deixa! Funcionou? Não mexa!"

Poston Tue, 03 Nov 2009 4:46 pm

Yes, but the workaround mentioned above is to manipulate that information. Let's say that the first page has to stay with the number 20, for example. (to be attached to tax books, etc, you have to have the numbering as the previous book) ...
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Tue, 03 Nov 2009 4:59 pm

Without problem.

I just test here.

I gave a double click on the << >> field of current page and there is a button titled << Page Numbering. >>.
To give a click on it opens a new window where you have a << option Start at: >> changed from 1 to 20.

I did the same procedure for the second << >> field.

SUCCESS!

1 page, displays: 20/25 Page 2 displays: 21/3 Page 25, displays: 22/25 remembering: Reports 2.5
JOPA
Location: Salvador - BA

Atenciosamente,

João Paulo A. C. do Bomfim

"Deu certo? Deixa! Funcionou? Não mexa!"

Poston Thu, 17 Dec 2009 1:04 pm

Hi guys, I found a code sent by Dr. Gori as follows below: <<<<INICIO>>>>>>>>>
Doc ID: Note: 130432.1 Subject: HOW TO PRINT THE REPORT TOTAL PAGES ONLY AT THE LAST PAGE Type: BULLETIN Status: PUBLISHED Content Type: TEXT/X-HTML Creation Date: 11-JAN-2000 Last Revision Date: 05-DEC-2001 SCOPE & APPLICATION-------------------This document gives a workaround to get the report total pages number and use it , in the format trigger of the field so that will be printed ONLY at the last page of the report.

The problem is that you cannot refer to a field with source total_pages in the format trigger of another field without getting the error '-730 The following bind variable is not defined ', and also there is not any build in function (like srw. get_page_num) to calculate the total report pages.



HOW TO PRINT REPORT PAGES in TOTAL AT LAST PAGE--------------------------------------------1. Add in the report 2 fields: total_pages with source ' Total Pages ' and page_num with source ' Page Number '.
2. Create in the database the table page_num to store the number of pages of the report. You can also add in this table another column to store the session id in order to insert the page numbers with a unique identifier for this report instance and be able to use this technique for multiple reports.
The description of the table page_num will be: Name Type-----------------------------------SESSION_ID NUMBER (10) PAGE_NUM NUMBER (10) (You can also use the local package variable to store the page number instead of inserting it in the database table).

In the format of the field trigger total_pages write the following code in order to get the total pages of the report and insert this number in the table:
Code: Select all
function total_pagesFormatTrigger return boolean is                           
  page_num number;                                                             
  a number(3);                                                                 
begin                                                                           
  srw.get_page_num (page_num);                             
  a:= page_num;
  insert into page_num values(global.session_id,a);
  commit;                                                                                                                       
  return (TRUE);                                                               
end;   
; session_id comes from a package variable you have previously created in order to get the session id.

The package specification and body is as follows:
Code: Select all
PACKAGE global IS
        session_id number(10) ;
END;

PACKAGE BODY global IS
begin
select  sid
into    session_id
from    v$session
where   audsid = userenv('sessionid') ;
END;
In the format trigger of the page_num field write the following code in order to retrieve the total pages from the database, compare it with the current page and print it if current page is equal to the last page:
Code: Select all
function page_numFormatTrigger return boolean is                                   
  this_page number;                                                             
  a number;                                                                     
  b number;                                                                     
begin                                                                           
  srw.get_page_num(this_page);                                                 
  a := this_page;
  select max(page_num) into b from page_num
  where session_id = global.session_id;                                                               
  if a = b then                                                                 
    return(TRUE);                                                             
  else                                                                         
    return(FALSE);                                                               
  end if;                                                                       
end;
Finally delete the records in the table after the page_num report ends in the After Trigger Report :
Code: Select all
function AfterReport return boolean is
begin
  srw.do_sql('delete from page_num where session_id = ' || to_char(global.session_id));
  srw.do_sql('commit');
return (TRUE);
end;
<<<<FIM>>>>>>>>> but what I'm realizing the trigger field page_num this running before the trigger field total_pages, that is when I get the select max (page_num) get as retorn null, does this problem this related to run hierarchy? There's how to handle it, does anyone know what I am doing wrong?

from already thank the attention.

abraco
ferik
Location: LINS - SP

Fabio Erik Goncalves


  • See also
    Replies
    Views
    Last Post


          Return to Reports

          Who is online

          Users browsing this forum: No registered users and 3 guests