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!

Getting a statement to print on last page only - Postscript Report

Status
Not open for further replies.

BONDfan

Programmer
Feb 20, 2002
12
US
Hello All,

First, I am using Report Developer 6i, and although I've been using it or 4 years, I've had to learn on my own due to lack of support for sending me to classes, and I am also responsible for reports in a host of other applications using Access and Noetix, so I am spread considerably thin in trying to concentrate all my focus to just one reporting system.

I have a report designed in Postscript to print Invoices. This Invoice report consists of a header page, the Invoice(s), and a Trailer Page. One of our subsidiaries wants a "Recipient" statement printed under certain conditions, one of which is that if this Invoice stretched more than one page, it must print on the last page of the Invoice only. This statement is in the Margin of the Main Section of the layout.

I have covered that part (although I may be just lucky and it's printing that way), but the problem is when the Invoice is only 1 page (very rare for them) this statement does not print. I wanted to use the TOTAL PHYSICAL PAGES variable in trying to calulate when to print the statement, but from what I can find, this variable is not accessable to use in that manner.

I then started researching and found the SRW.GET_PAGE_NUM package and the suggestion of using Global Variables. My problem is I've never set up a Package(Spec, Body, etc.), and every time I've found info on this, it's never quite explicit enough to allow me to create this from start to finish - most explanations are as though the requestor had some knowledge of this area, and regretfully, I do not (although I'm trying to gain this knoweledge).

Can anyone walk me through this step by step - I think I can deal with triggers and such, but for some reason this Report Package stuff just isn't quite sinking in. Or if not, can you point me to a destination in which I can find my answer?

Thanks and Regards
Lanny
 
Lanny,
Welcome to Oracle Reports - a never ending learning experience!

Normally, I only use the margins for boilerplate that prints on every page. Is there some reason you cannot put the Recipient statement in a frame as the last thing on your main section page with a trigger that will be able to suppress it?
Code:
function abcFormatTrigger return boolean 
is
	V_PAGE	number;
begin
	SRW.GET_PAGE_NUM (V_PAGE);
	if	V_PAGE > 1 THEN
		return (TRUE);
	end if;
	return (FALSE);
end;
Creating a package is easier than you think. On the Object Navigator, click on Program Units. Then click on the green + sign to create a new unit. Give it a name and click on the Package Spec radio button, then click on OK. Create your Global Variable:
Code:
PACKAGE TEST
IS
	GV_PAGES	number;
END;
No need to create a Package Body if you do not need it.

Good luck!


[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: Emu Products Plus
 
Hi,

Thank You very much for the reply.

First, the reason I didn't put the statement on the main section was that there is boilerplate (in the margin) that prints Tax info on every page, as well as our company branding and Banking details(when it's overseas). On the main section layout are the Invoice header info at the top, stationary of course, and then Invoice lines in a repeating frame which has vertical elasticity set to Variable to allow for 1 or more Invoice Lines. The problem I ran into was that the Recipient statement would never stay in one fixed spot and would float with the repeating frame expansion, causing it to appear mixed with the Tax line. I figured the best place to put it was with the boilerplate, where I knew it wouldn't move.

I'm just a little confused with your code. In the PACKAGE you called the variable GV_PAGES, in the format trigger you used V_PAGE. How do they tie in together? If I want to create another global to save, for instance, TOTAL PHYSICAL PAGES for use in the 'After Report' report trigger, would I have to create another Packge just for that variable? How does it know to associate GV_PAGES and V_PAGE?

I did use what you created for me and it worked and is very much appreciated!

Thanks
Lanny
Lanny
 
Sorry to be confusing. The first snippet was just the format trigger sample - not intended to be referencing the Global Variable.

To reference the Global Variable you would use TEST.GV_PAGES in your code.

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: Emu Products Plus
 
Hi,

Sorry for the delay in responding. I think I've got this down, to a point. Another question for you on this same subject (and please let me know if I should open up a new thread).

I have put the following in Program Units:

Package Global_Page_Num IS
GV_PAGES number;
GV_TOT_PAGES number(2);
END;

I think I've got the GV_PAGES down. My problem lies with GV_TOT_PAGES. I put a field onto the Trailer page, thinking it was the last page and I could use that to get my total pages. In the Format trigger for the field I put:

function F_1FORMATTRIGGER0011 return boolean is
begin
SRW.GET_PAGE_NUM(Global_Page_Num.GV_TOT_PAGES);
SRW.MESSAGE(0,'GV_TOT_PAGES is '||to_char(Global_Page_Num.GV_TOT_PAGES));
return(TRUE);
end;

No matter where I put the SRW.MESSAGE code, even in the AFTER REPORT report trigger, I still get the answer for GV_TOT_PAGES as being 1, when what I am looking for in a particular case is 7.

Thanks and Regards
Lanny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top