Inserting Page Breaks after 'n' records [message #179081] |
Sat, 24 June 2006 23:08 |
harry1122
Messages: 1 Registered: June 2006 Location: Hyderabad
|
Junior Member |
|
|
Hi,
I am facing a strange request from a client who is using Discoverer reports. the client want to be able to choose the number of records displayed per page when exporting the report and/or print. the number of records is to be dynamic and can vary for the same report every time it is run. i have already pointed it out that page breaks can be inserted at each group and subgroup level. but he is adamant that the number of records to be printed per page has to be a dynamic run time input. can any of you help in this matter?? even if it is not possible is there any workaround like when the user clicks on the print button, i change the underlying logic to take a user input to insert page break after a specified number of lines of a group/subgroup.
thanks in advance
|
|
|
|
Re: Inserting Page Breaks after 'n' records [message #181329 is a reply to message #179106] |
Sat, 08 July 2006 15:10 |
dude4084
Messages: 222 Registered: March 2005 Location: Mux
|
Senior Member |
|
|
i can try to give u idea.
Assume
1) there are 80 records possible on ONE page
2) We are using famous EMP table having 60 records
3) User has given 7 as input. Thus 7 records as required to be diaplyed on per page
Make a function as following.
(Please correct the syntax yourself as i dont have SQL installe on this PC, so sonsider my guidence as PSedocode)
create or replace function myreport
(PIN_records number(2)) RETURN CHAR IS
mrecord number(2):=PIN_records
mcount number(2):= 1;
ans varchar2(99999):= null;
begin
Select j in (Select * from emp) loop
mans = mans || j.ename ||to_char(sal)
mcount = mcount+1;
If mcount = mrecord then
for k in mcount..80
mans = mans || CHR(10);
end for
mcount:=1;
end if;
end loop
after creating this function, call the rpeort as follow
Select myreport(7) from dual;
Thats All!
========================
Note:
--CHR(10) Gives Cariage Return/ Enter Key/ New Line
--You have to tackle the headers as well. You can do it in functions
--Flexibility gone as we are treating all COLUMNS as CHARACTER
--The TOTAL ouput can not be greater than 99999 width. Dont know the upper limit.
=========================
It is just an idea to work on
Hope for the best
-Dude
|
|
|