PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • Principle for printing a report
  • Report with lower and upper bounds
  • Executing a query and a report based on this query
  • Print destination
  • Passing parameters
  • Printing a component report
  • RPC and independent HFSQL context
  • Nested reports
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Prints a report created with the report editor.
Caution: The WLanguage code required to print the report depends on the report data source. For more details and examples, see:
Versions 15 and later
Linux The reports are available in PDF format in Linux. For more details, see Printing in Linux.
New in version 15
Linux The reports are available in PDF format in Linux. For more details, see Printing in Linux.
Linux The reports are available in PDF format in Linux. For more details, see Printing in Linux.
Versions 18 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 18
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 25 and later
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
New in version 25
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.

Important

With Reports & Queries, you can print a report via one of the following options:
  • by printing directly ( ).
  • by opening the report test window ( ).
Therefore, no programming is required to print the report.
In order for the reports created in Reports & Queries to be directly printed from a WINDEV application, this feature must be implemented by the provider of WINDEV application.
The provider can for example include a window allowing the end user to:
  • select a report created in Reports & Queries.
  • run this report.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
// Impression simple sur imprimante
iPrintReport(ETAT_Facture)
WINDEVReports and QueriesUser code (UMC)
// Impression dans le visualisateur de rapports
iDestination(iViewer)
iPrintReport(ETAT_Facture)
WEBDEV - Server code
// Création d'un nom de fichier unique
MonFichierUnique is string = fDataDir() + "\" + DateSys() + TimeSys() + ".pdf"
// Destination de l'état: Impression de l'état dans un fichier PDF
iDestination(iPDF, MonFichierUnique)
// Impression de l'état basé sur le champ Table "TABLE_TableClient"
iPrintReport(ETAT_TableClient)
// Affichage de l'état au format PDF
FileDisplay(MonFichierUnique, "application/pdf")
// Suppression du fichier
fDelete(MonFichierUnique)
Syntax
<Result> = iPrintReport(<Report> [, <Parameter 1> [... [, <Parameter N>]]])
<Result>: Type of result returned by the report (optional)
Versions 20 and later
Value returned by printing the report. This value is returned:
  • or by the keyword RETURN in the report closing code.
  • by ReturnedValue used before closing the report.
New in version 20
Value returned by printing the report. This value is returned:
  • or by the keyword RETURN in the report closing code.
  • by ReturnedValue used before closing the report.
Value returned by printing the report. This value is returned:
  • or by the keyword RETURN in the report closing code.
  • by ReturnedValue used before closing the report.
<Report>: Name of the report or string
Report to be printed:
  • Name of the report, defined in the report editor.
  • Physical name of the report (including its path) if the compiled code is included in the report.
WEBDEV - Server code This parameter can only correspond to the report name defined in the report editor. You cannot use the physical name of the report.
<Parameter 1>: Optional parameters (the type corresponds to the parameter type)
Optional parameter expected by the report. This parameter was defined in the report opening code. This parameter can be the name of a view, the name of a memory area, etc.
Caution: If lower bounds and upper bounds have been specified for the report, the first two parameters must correspond the lower bound and to the upper bound (respectively).
<Parameter N>: Optional parameters (the type corresponds to the parameter type)
Optional parameter expected by the report. This parameter was defined in the report opening code. This parameter can be the name of a view, the name of a memory area, etc.
Caution: If lower bounds and upper bounds have been specified for the report, the first two parameters must correspond the lower bound and to the upper bound (respectively).
Remarks

Principle for printing a report

iPrintReport reads the report data source (data files, query, Table control, etc.). iPrintReport prints the Body block for each record. The other blocks are printed when necessary:
  • The Start of document block will be printed at the beginning of document.
  • The End of document block will be printed at the end of document.
  • The Page header block will be printed at the top of each page.
  • The Page footer block will be printed at the bottom of each page.
  • If there is a break, the Body block of the break will be located between the Break header block and the Break footer block.

Report with lower and upper bounds

If the lower and upper bounds were specified when the report was created in the report editor, the first two parameters passed to the report via iPrintReport must correspond to the lower bound and to the upper bound, respectively.
Example: a report was created on Customer file. This report browses the file on the "CustomerNum" key item. This report was defined as being bounded, with specified minimum and maximum bounds ("Data" tab in the report description window.
The following code is used to print the report for customers 2 to 5:
iDestination(iViewer)
iPrintReport(ETAT_Clients_Prospects, "2", "5")

Executing a query and a report based on this query

When printing a report based on a query, if the query has already been executed, it is not executed again. To re-execute the query (to add records, for example), simply use HExecuteQuery or iInitReportQuery.

Print destination

You can set the print destination of the report using iDestination.
WINDEV iDestination with the iViewer constant is used to display the printout in a report viewer. The user can then select the printing mode (PDF, printer, etc.). To find out whether the print was started from the report viewer, use iDocumentPrinted.
WINDEVWEBDEV - Server codeUniversal Windows 10 AppAndroidiPhone/iPadUser code (UMC)Ajax

Passing parameters

The parameters specified by iPrintReport correspond to the parameters defined in the report opening code via the following syntax:
PROCEDURE <NomEtat> (<NomParam1>, <NomParam2> = "<ValeurParDéfaut>", ...
<NomParamN> = "<ValeurParDéfaut>")
Reminder: Some of the parameters passed to a procedure can be optional parameters. When declaring the procedure, the optional parameters must be described in last position (on the right), with a default value preceded by the "=" sign. For more details, see Procedure parameters.
If the report is based on a query, iInitReportQuery must be used to pass the query parameters before printing the report.

Printing a component report

To print a component report, use the name of component report (the component being included in the project). For example:
iPrintReport(EtatDuComposant)
If a conflict occurs with a project element, the name of the element must be prefixed by the name of the component. For example:
iPrintReport(MonComposant.Etat)
To use the name of the report in a variable, the name of the component must be specified. For example:
sEtat is string = "MonComposant.MonEtat"
iPrintReport(sEtat)
WINDEVReports and QueriesUser code (UMC)

RPC and independent HFSQL context

The access to an HFSQL data file in RPC is not allowed from a report with an independent context.
The "Independent HyperFileSQL context" option must be disabled.
To disable this option in a report, uncheck "The report execution does not affect the browse operations (independent HyperFileSQL context)" in the "Data" tab of the report description.
The "Independent HFSQL context" option must be disabled.
To disable this option in a report, uncheck "The report execution does not affect the browse operations (independent HFSQL context)" in the "Data" tab of the report description window.
In an application that uses the remote access, if independent contexts must be used, they must be programmed by HSavePosition and HRestorePosition.
Remark: The contexts cannot be copied in RPC. You must use HOpenAnalysis or HConnectRemoteAccess in the new context to access the RPC.

Nested reports

It is possible to call the iPrintReport function within an report. For more details, see the help about the Nested reports.
Business / UI classification: Neutral code
Component: wd270etat.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment