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.

Example:The program required to create a report with parameters is illustrated by the following example:The "RPT_ParamReport" report corresponds to a mailshot sent to the customers. Thisreport expects in parameter the text of the mailshot entered in the "EDT_MailshotText" editcontrol.1. Create the "RPT_ParamReport" report. This report is a Mailshot report. This report is linked to the "Customer"file of your analysis.2. Customize this report.3. Enter the following code in the "Opening" process of the "RPT_ParamReport" report:4. In the Body block of this report, add the "STC_MailshotText" static control used to display the text ofthe mailshot.5. Enter the following code in the "Pre-print" process of the "STC_MailshotText" control:6. In an application window or in a site page, add:• the "EDT_MailshotText" edit control allowing the user to enter the text of the mailshot.• the "Print" button used to print the report.15.6.2 Printing a report with parametersTo print a report with parameters, 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 in iPrintReport:• the name of the report to print.• the parameters.Notes:• If the report is based on a HFSQL view, the name of this HFSQL view must be specified in iPrintReport,before the parameters. See “Report based on a HFSQL Classic view”, page 47 for more details.• If the report is based on a memory zone, the name of this memory zone must be specified in iPrintReport,before the parameters. See “Report based on a memory zone”, page 47 for more details.• If the report is bounded, the maximum and minimum values of the bounds must be specified in iPrintReport,before the parameters. See “Bounded report”, page 45 for more details.Example:// Retrieve the parameter passed to the report and// pass a default parameter for the test of the reportPROCEDURE RPT_ParamReport(sText = "Default value")// Retrieve the text of the mailshotSTC_MailshotText = sTextThe "RPT_ParamReport" report corresponds to a mailshot sent to the customers. Thisreport expects in parameter the text of the mailshot entered in the "EDT_MailshotText" editcontrol.The "RPT_ParamReport" report is printed during a click on the "Print" button.In this example, the code of "Print" button is as follows:140Part 1: Report editor

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

Saved successfully!

Ooh no, something went wrong!