KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Sending Quick Reports to a printer without user interaction
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: September 17, 2009
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When a Quick Report is built or saved in an offscreen area and sent to a printer with the QR RUN command, the printer dialog window will be displayed. This can be an undesirable outcome in certain situations. For example, when the developer programatically specifies a certain printer for printing reports or the QR RUN command is executed on the server.

This is the code snippet for such a call:

`this method has Execute on Server property checked on.
`QR_Area is the offscreen area
`$docContent is a blob variable which contains our quick report
`$tableNumber is a longint containing the table number where the QR will be applied

QR SET REPORT TABLE(QR_Area;$tableNumber)
QR BLOB TO REPORT(QR_Area;$docContent)
QR DESTINATION(QR_Area;qr printer)
QR RUN(QR_Area)
QR DELETE OFFSCREEN AREA(QR_Area)


Displaying the printer dialog window can be avoded by calling the QR SET DOCUMENT PROPERTY command right befere the QR RUN call.

The code is as follows.

QR SET REPORT TABLE(QR_Area;$tableNumber)
QR BLOB TO REPORT(QR_Area;$docContent)
QR DESTINATION(QR_Area;qr printer)
QR SET DOCUMENT PROPERTY(QR_Area;1;0)
QR RUN(QR_Area)
QR DELETE OFFSCREEN AREA(QR_Area)


In this way the quick report will be sent to the printer without user interaction.

Commented by Jesse Pina on November 6, 2009 at 11:35 AM
This can come in very handy when setting up reports to automatically run on a regular basis.