Re: URGENT!!!! Changing paper tray

From: Thomas Grundey <grundey_at_ibm.net>
Date: 1997/05/04
Message-ID: <336c4705.867705_at_news-s01.ny.us.ibm.net>#1/1


>Marko Krczal wrote:
>>
>> How can I change the paper tray in report dynamically ????
>

In reports which are printed on a hp laserjet (PCL) I do the following:
1. Set a user variable first_copy to TRUE or FALSE I do this in a compute field of the main query. A result of the query is n_copies_wanted. I join with a table NUMBERS which contains nothing more than the numbers 1, 2, 3 ...
select ....

        a.n_copies_wanted,
       NUMBERS.number

from a, numbers
where a.n_copies_wanted <= number;

If n_copies_wanted is 3, I get the results three times with his mechanism.
In the compute field I set first_copy to TRUE if number = 1, otherwise to false.
2. on the MARGIN I have 2 text fields which contain PCL escape sequences for the tray selection (esc&l4) or somethong like that. I got the esc from an editor which allows to insert hex-codes (CHR may also work). If first_copy isTRUE, the format trigger for the string which selects the first tray returns true, the format trigger for the other string is false.
And vice versa.

This does work only on the margin, which contains only the two strings. Reason: The strings on the body appear in the PCL file sent to the printer not in a from top left to bottom right order. Even if you place your sequence in the upper left corner of your page, it may be placed in the middle of your other text data. Because I need to acess the information on the margin, I used a variable, not directly the query result.

With that trick it is possible to print the first copy for each query result on paper from tray 1, the second and other copies from tray 2. It works with more than one query result, even in the case that the querys data have to be printed on more than one page. It is a graphics report, not a character report and I use the Laserjet printer driver.

One drawback however:
This works under Win 3.xx, but not under NT 3.51 (what happens under Windows 95 I don't know). Under NT the esc sequence is not sent to the printer, instead I see &l4 printed on the page. This is the case with both 16bit and 32 bit Oracle tools under NT. The oracle hotline knows about it and it is considerd as bug. They filed an enhancement request.

Is there anybody out there who has more information on this exotic topic (a shame that it is not possible to use printer codes in a more direct way).
T. Grundey Received on Sun May 04 1997 - 00:00:00 CEST

Original text of this message