Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Illegal print condition

Status
Not open for further replies.

tiblu

Programmer
Aug 6, 2004
4
EE
Hi!

I have to make a report where there is signature fields at the end of every page but on the last page the fields have to be right after the text.
What I tried was to dublicate the fields. One at the end of the text and other in the margin section to be repeated on every page. If I set print condition All But Last it will give me an error "Illegal print condition".
I was thinking of making a format trigger but how can I get a value from a field? I have page number field on the report, so I would like to make it print something if the value is not equal to total page count.

Conclusion: Need to print field on every page except last one.

I hope you understand me, English is not my native language.

Pleas be detail in your explanations, I'm just a noob at this :)

Thank You
 
Oh and the Report Builder version is 6.0.5.32.0.
 
Suprisingly, it is extremely difficult in Oracle Reports to catch the fact that certain page is the last page. There is a method described on metalik requiring creating a temporary table for that.
If your report has any regular structure, like the same number of records on each page, you may think about linking signatue box to the last record on page. That is inserting it into the record repeating frame and suppressing for all records but those with record numbers proportional to number of records per page.
If your report has any different structure, please tell more about it to try to think about something else.
 
Thanks for posting. English is not my native dongue so I'll try to restate my problem.
I have a report, the number of pages can be from 1 to 3 pages and the number of records on a page can be different also. What I need is to get signature text at the end of every page (in the footer) but on the last page the signatures should be just after the text.
One possible way would be write a format trigger that shows the signature frame in the footer on every pages footer but not on the last page footer. For doing that I need to know total number of pages so I could compare current page number and total pages number according to case I would show or not show the frame. Only problem is that I can't possibly get total page number. There were some posts at Oracle Forums about that but I could not get none of these examples to work.
The illegal print condition is because can't set print condition if the object is in the margin area. If I but it in the body it will print on the last page even if I set print condition to "All But Last", thats propably because my whole page is on one logical page, how to make it devide to many logical pages - I have no idea. I have read the manual but maybe I can't understand English well enough. Now I am in deep :).
Forms need to be tested and released and this is the only thing that is undone.
I hope I was able to explain my problem better than I did at the first time.
Thank You.
 
You are saying the report may have up to 3 pages? How do you know this? Why it can not be 4? Let's think if there is any way to predict how many pages the report going to have. May be it depends on the number of records returned by SQL, these records can be counted before the report is run. May be it depends on certain sections to be included or not included in the report. Again, this very likely can be analyzed before the report is run. Tell us more what the report consists of and what makes it to have either 1, or 2, or 3 pages.
 
Ok. Mostly there are text that does not change, just some sums change and stuff. So I predict there will not be more than 2-3 pages. My problem would be solved if I knew how to get total pages number to write the trigger. Logical pages/ Physical pages arg.. if I knew the difference and how to devide to pages I would propably solve the problem pretty soon. My English is bad enough to not understand the part about pages in the manual or something.
Waiting for useful hints. Thanks to Nagornyi for keeping me running.
 
As it looks like no better solution is available so far (please let us know if you found it), here is what Oracle recommends in this situation.
Code:
Doc ID: 	Note:111587.1
Subject: 	How to get total number of pages for a report before printing?
Type: 	BULLETIN
Status: 	PUBLISHED
	
Content Type: 	TEXT/PLAIN
Creation Date: 	01-JUN-2000
Last Revision Date: 	28-NOV-2001

PURPOSE 
-------

The purpose of this article is to provide users and analyst with information about
How to get how many pages in the report and also the number of the last page of the
report programmatically before printing the report to decide if you will print it or not.
How many pages to print. Also formatting his page number field.

SCOPE & APPLICATION
-------------------

This article is simple steps and coding for expert as well as intermediate users.
Suppose you have a report and you don't know in advance how many pages will be printed
when you run this report. This report may be huge one that you don?t want to print all the pages
and you want to stop printing the report after certain number of pages.
You may also would like to have the choice of having page number or not and how the page number looks like.
As an example; if you have a report that consists of 10 pages then you would like to have page number as follows
(page 1 of 10). In case that your report consists of only one page you don't want any page number for it.

How to print certain number of records
--------------------------------------

In BeforeReport trigger (after the query is parsed) you can call
SRW.Set_Maxrow(?query_name?, <number of records to be printed>);

Example:

function BeforeReport return boolean is

begin
SRW.SET_maxrow('Q_1', 5);
return (TRUE);
end;

You can also use a user parameter to dynamically specify the number of records that you want to print.

How to print certain number of pages
------------------------------------

First you have to know how many records are printed per page in your report which means that
you have to print at least one or two pages of your report first then count how many records are printed/page.
These two parameters will be used to control how many pages to be printed.
The number of records per printed page depends on many parameters such as report style, layout, font, template,
and Maximum Records per page property for each repeating frame.

Example
-------

Suppose that the number of records per printed page = 30 and you want to print 20 pages
then the number of records that you have to specify in the SRW.Set_Maxrow should be
No. of records per printed page * No. of pages that you want to print which would be 600
You can also use user parameters to dynamically control that.

How to get the total Number of pages of the report
--------------------------------------------------

1- Run your query first and count the number of records retrieved by this query.
2- Calculate the number of records/printed page.
3- To get the total number pages of the report you have to divide the
number of records retrieved by the query over the number of records per printed page.
From this information you can decide whether you want to print the whole report or not.
Also you can choose which page number format you want to use.
Hint: To choose between different Page Number format you have to create two fields in the
margin each one with different page number format. You can choose which one to display using
format trigger on those fields.
Disadvantage of above method that the query will be executed twice one for getting the count of records
and the second time to execute the query of the report itself. Which will cause a little bit longer time
to run the reports. To save more time write the same query in the same case to save the parsing time of
the query in the second time.

Related information
-------------------

SRW.SET_MAXROW built_in
Syntax

SRW.SET_MAXROW (query_name CHAR, maxnum PLS_INTEGER);
Parameters

query_name Is the query whose fetched records will be limited.

maxnum Is maximum number of records you want the query to fetch.

Restriction

- SRW.SET_MAXROW is only meaningful in a Before Report trigger
(i.e., after the query is parsed). If SRW.SET_MAXROW is called after the Before Report trigger
(i.e., after the queries have been executed), the SRW.MAXROW_UNSET packaged exception is raised.
- Because this procedure causes only the specified number of records to be fetched, the "unfetched"
records of the query are not used in computations, etc.

- If you specify that 0 records should be fetched, the query will still be parsed.

KEY WORDS
--------

SRW.SET_MAXROW; MAXROW; Maximum rows to fetch; pages; pagenumber; lastpage;

RELATED DOCUMENTATION
---------------------

note:61643.1 USING SRW PACKAGED PROCEDURES IN REPORTS
Oracle Reports Builder Online Help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top