13.07.2015 Views

Reports & Queries - Source : www.pcsoft-windev-webdev.com

Reports & Queries - Source : www.pcsoft-windev-webdev.com

Reports & Queries - Source : www.pcsoft-windev-webdev.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

WebDev example:The "RPT_CustomerReport" report is a bounded report based on the "Customer" file. Thisreport is used to print the characteristics of the customers whose name starts with the letter"D".The lower bound corresponds to "D". The upper bound corresponds to "D"+hMaxVal.The "RPT_CustomerReport" report is printed in an HTML file and it is sent to the browserduring a click on the "CustomerD" button.In this example, the click code of the "CustomerD" button is as follows:// Generates a unique file namePDFFile is string = fWebDir() + "\" + ..."RPT_CustomerReport_" + DateSys() + TimeSys() + ".pdf"// Configures the destination of the printiDestination(iPDF, PDFFile)// Prints the RPT_CustomerReport reportiPrintReport(RPT_CustomerReport, "D", "D" + hMaxVal)// Sends the file to the browserFileDisplay(PDFFile, "application/pdf")// Deletes the filefDelete(PDFFile)12.2.3 Printing a report with parameters based on a data fileTo print a report with parameters, parameters must be passed to the report.To print a report with parameters based on a data file, you must:1. Configure the destination of the print:•In WinDev: use iPreview (print preview, print in an HTML file, …).•In WebDev: use iDestination (print in an HTML file, …).• In WinDev Mobile: use iConfigure or iParameter. These functions open a dialog box allowing the userto select the default printer.2. Specify the following parameters with iPrintReport:• the name of the report to print.• the parameters expected by the report (in the order specified in the report).WinDev example:The "RPT_ParamReport" report corresponds to a mailshot sent to the customers. Thisreport expects in parameter:• the text of this mailshot entered in the "EDT_MailshotText" edit control.• the date for sending this mailshot entered in the "EDT_SendDate" edit control.This report is printed during a click on the "Print" button. The "RPT_ParamReport" report isbased on the "Customer" file.In this example:• the click code of the "Print" button is as follows:// Open the preview windowiPreview()// Print the report while passing parametersiPrintReport(RPT_ParamReport, EDT_MailshotText,...EDT_SendDate)116Part 1: Report editor

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!