ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Report editor / Data sources
  • Overview
  • Creating a report based on a data file
  • Bounded report based on a data file
  • Defining a bounded report
  • Printing a report based on a data file
  • Printing a bounded report based on a data file
  • Printing a report with parameters based on a data file
  • Printing a bounded report with parameters based on a data file
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
Report based on a data file
Overview
A report based on a data file is used to print the records coming from a single data file (HFSQL Classic or Client/Server, accessed via a Native Access, ...). If the records come from several files, we recommend that you use a report based on a query.
Characteristics of a report based on a data file
The characteristics of a report based on data file are as follows:
  • Search key: a report based on a data file uses a search key. This key is used to browse the records that will be printed in the report. This key is defined in the data file.
  • Bounded report: a report based on a data file can be bounded. These bounds are used to define the range of records that will be printed in the report. For more details, see Bounded report based on a data file.
A report based on a data file can be created via the report creation wizard. This type of report can be created only if the current project is associated with an analysis.
Once the report based on the data file has been created, you can:
  • change the data source of the report ("Data" tab in the report description).
  • modify the search key ("Data" tab in the report description).
  • define the bounds ("Data" tab in the report description).
  • add or delete Item controls linked to the data file associated with the report.
The data files and the file items that can be used in the reports created with Reports & Queries are defined by the developer in the data model editor of WINDEV.
For more details on the requirements to use a WINDEV application with Reports and Queries, see Preparing a WINDEV application in order to use it with Reports & Queries.

This help page presents:
Creating a report based on a data file
To create a report based on a data file:
  1. Click New in the quick access buttons.
    • The new element window appears: click "Report" then "Report".
    • The report creation wizard starts.
  2. Choose the layout of your report (table, form, label, ...). For more details, see The different types of reports.
  3. Select (if necessary) the report template to use. A report template is used to comply with a specific page layout. For more details on report templates, see Report templates.
  4. Select the report data source: "from a data file or from an existing query" option.
  5. Select the data file on which the report is based. The description of this data file must be in the analysis associated with the current project.
  6. Select the search key of this report. This item will be used to browse the records of the selected data file.
    For a bounded browse, specify the values of the bounds that will be given to the report.
  7. Select the sort items for the report. These items will be used to sort the data printed in the report. For more details on sorts, see Sorts in a report.
  8. To group the records, you have the ability to create breaks on the sort items. To create breaks, answer "Yes" to the question "Do you want to add some breaks into the report?".
    The next step is used to select the sort items corresponding to the breaks. For more details on breaks, see Breaks in a report.
  9. For each data file item displayed in the report:
    • type the corresponding caption. This caption will be displayed:
      • before the item. For example:
        Libellé
      • in the column header (for the Table reports). For example:
        Libellé
        This caption can be modified in the report editor.
    • select the block where the control associated with the item will be printed. The positions of different controls can be modified in the report editor. For more details on the different blocks and their position in a report, see Report blocks.
  10. Modify (if necessary) the display order of controls in the report with the arrow buttons found on the right of table.
  11. If the data file associated with the report contains at least one numeric item, some calculations can be performed on these items. Specify the calculation performed for each item (sum, average, ...). Two types of calculations are available:
    • general calculation: a Calculated control will be created in the End of document block.
    • calculation on break: a Calculated control will be created in the Break footer block. In the calculations on break, the result of the calculation is reinitialized after each break. To perform a calculation on break, a break must be found in the report currently created.
  12. Depending on the type of report currently created, indicate the specific options.
    Type of reportSpecific options
    Report based on a formForm image, printing the form image, ...
    Options presented in detail in Report based on a form
    Label reportFormat of labels, number of identical copies, ...
    Options presented in detail in Label report
  13. Specify the format of sheet on which the report will be printed. The report is printed in A4 format by default.
    Remark: By default, the report controls are displayed in a single column. To create a multi-column report, simply specify the desired number of columns in the "Format" tab of the report description window.
  14. Select the skin template of the report if necessary.
  15. Type the name and title of the report (name of ".WDE" file corresponding to the report). This name will identify report in your programs..
    WINDEV You can also specify whether the report can be modified by the end user in "Reports & Queries".
  16. Validate the report creation.
  17. The report editor automatically proposes to change the report format if the following conditions are fulfilled:
    • the report currently created includes a table.
    • the report format does not allow to display all table columns.
  18. Specify (if necessary) the mode for reducing the report size:
    • Print the report on several pages. In this case, the end user will have to group the pages. For more details, see Multi-page print.
    • Use the landscape mode.
    • Reduce the report size. Caution: according to the reduction percentage, the printed report may become unreadable.
  19. The report currently created is displayed in the report editor.
Bounded report based on a data file
A report based on a data file can be bounded on the search key used. For example, a report based on the "Customer" data file can print all the customers, or only the customers whose names start with "D" or "E" if the report is bounded.
A bounded report can be defined:
  • when creating the report.
  • in the report description directly ("Data" tab).

Defining a bounded report

To define a bounded report:
  1. Select:
    • "Minimum value provided" and/or "Maximum value provided" when creating the report.
    • "Lower bound" and/or "Upper bound" in the "Data" tab of the report description ("Report description" from the popup menu of the report).
  2. Specify the lower bound and/or the upper bound when printing the report with iPrintReport, or with the MinValue and MaxValue properties. For more details, see Printing a bounded report.
Remark: When testing a bounded report (Go in the quick access buttons), a window allows you to enter the bounds of the report.
Printing a report based on a data file
To print a report based on a data file, you must:
  1. Configure the report print destination:
    • WINDEV In WINDEV, with iDestination (report viewer, print in an HTML file, etc.).
    • WEBDEV - Server code In WEBDEV, with iDestination (print in an HTML file, etc.).
    • AndroidiPhone/iPad In Android and iOS, with iDestination (print in a PDF file).
    For more details, see Print modes of a report.
  2. Specify the name of the report to print with iPrintReport.
Additional parameters must be specified in the following cases:
  • Printing a bounded report based on a data file.
  • Printing a report with parameters based on a data file.
  • Printing a bounded report with parameters based on a data file.
In Reports & Queries, you can print a report:
  • by starting a print job (Imprimer).
  • by testing the report (Go).
Therefore, no programming is required to print the report.

WINDEVWINDEV Mobile WINDEV and WINDEV Mobile examples The "RPT_Customer" report is based on the "Customer" data file. This report is used to print the characteristics of customers.
"RPT_Customer" is printed during when "BTN_Customer" is clicked on. In this example, the click code of "BTN_Customer" is as follows:
  • WINDEV WINDEV code:
    // Ouvre le visualisateur de rapports
    iDestination(iViewer)
    // Imprime l'état ETAT_Client
    iPrintReport(ETAT_Client)
  • AndroidiPhone/iPad Android/iOS code:
    // Paramètre la destination de l'impression
    iDestination(iPDF) 
    // Imprime l'état ETAT_Client
    iPrintReport(ETAT_Client)

WEBDEV - Server code WEBDEV example The "RPT_Customer" report is based on the "Customer" data file. This report is used to print the characteristics of customers.
The "RPT_Customer" report is displayed in a PDF file when clicking the "LINK_Customer" link. Then, the PDF file is displayed in the browser. In this example, the server click code of the "LINK_Customer" link is as follows:
// Génère un nom de fichier PDF unique 
NomFicUnique is string = fWebDir() + "\" + "ETAT_Client_" + DateSys() + TimeSys() + ".pdf" 
// Paramètre la destination de l'impression 
iDestination(iPDF, NomFicUnique) 
// Imprime l'état ETAT_Client 
iPrintReport(ETAT_Client) 
// Envoie le fichier dans le navigateur 
FileDisplay(NomFicUnique, "application/pdf") 
// Supprime le fichier 
fDelete(NomFicUnique)
Remark: When used in the code of the report, the SourceName property allows you get and change the name of the data file associated with the report.

Printing a bounded report based on a data file

To print a bounded report based on a data file, you must:
  1. Configure the report print destination:
    • WINDEV In WINDEV, with iDestination (report viewer, print in an HTML file, etc.).
    • WEBDEV - Server code In WEBDEV, with iDestination (print in an HTML file, etc.).
    • AndroidiPhone/iPad In Android and iOS, with iDestination (print in a PDF file).
    For more details, see Print modes of a report.
  2. Specify the following parameters with iPrintReport:
    • the name of the report to print.
    • the value of the lower bound for the report.
    • the value of the upper bound for the report.
WINDEVWINDEV Mobile WINDEV and WINDEV Mobile example
The "RPT_Customer" report is a bounded report based on the "Customer" data file. This report 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.
"RPT_Customer" is printed during when "BTN_CustomerD" is clicked on.
In this example, the click code of "BTN_CustomerD" is as follows:
  • WINDEV WINDEV code:
    // Ouvre le visualisateur de rapports
    iDestination(iViewer)
    // Imprime l'état ETAT_Client
    iPrintReport(ETAT_Client, "D", "D" + hMaxVal)
  • AndroidiPhone/iPad Android/iOS code:
    // Paramètre la destination de l'impression
    iDestination(iPDF) 
    // Imprime l'état ETAT_Client
    iPrintReport(ETAT_Client, "D", "D" + hMaxVal)
WEBDEV - Server code WEBDEV example The "RPT_Customer" report is a bounded report based on the "Customer" data file. This report 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. "RPT_Customer" is printed in an HTML file and sent to the browser when "BTN_CustomerD" is clicked on.
In this example, the click code of the Button control "CustomerD" is as follows:
// Génère un nom de fichier unique 
NomFicUnique is string = fWebDir() + "\" + "ETAT_Client_" + DateSys() + TimeSys() + ".pdf" 
// Paramètre la destination de l'impression 
iDestination(iPDF, NomFicUnique) 
// Imprime l'état ETAT_Client 
iPrintReport(ETAT_Client, "D", "D" + hMaxVal) 
// Envoie le fichier dans le navigateur 
FileDisplay(NomFicUnique, "application/pdf") 
// Supprime le fichier 
fDelete(NomFicUnique)

Printing a report with parameters based on a data file

To print a report with parameters, parameters must be passed to the report. For more details, see the Reports with parameters.
To print a report with parameters based on a data file, you must:
  1. Configure the report print destination:
    • WINDEV In WINDEV, with iDestination (report viewer, print in an HTML file, etc.).
    • WEBDEV - Server code In WEBDEV, with iDestination (print in an HTML file, etc.).
    • AndroidiPhone/iPad In Android and iOS, with iDestination (print in a PDF file).
    For more details, see Print modes of a report.
  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 WINDEV example
The "RPT_Param" report corresponds to a mailshot sent to the customers. This report expects as 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 when "BTN_Print" is clicked on. The "RPT_param" report is based on the "Customer" data file.
In this example:
  • the click code of "BTN_Print" is as follows:
    // Ouvre le visualisateur de rapports
    iDestination(iViewer)
    // Imprime l'état avec le passage des paramètres
    iPrintReport(ETAT_Param, SAI_TexteMailing, SAI_DateEnv)
  • the code of the report is as follows:
    // Récupère les paramètres passés Ã  l'état et
    // passe des paramètres par défaut pour le test de l'état
    PROCÉDURE ETAT_Param(sTexte = "Défaut", sDate = Today())
AndroidiPhone/iPad Android/iOS example
The "RPT_Param" report corresponds to an invoice. This report expects in parameter the delivery date entered in the edit control named "EDT_DelDate".
This report is printed when "BTN_Print" is clicked on. The "RPT_param" report is based on the "Customer" data file.
In this example:
  • the click code of "BTN_Print" is as follows:
    // Paramètre la destination de l'impression
    iDestination(iPDF) 
    // Imprime l'état avec le passage des paramètres
    iPrintReport(ETAT_Param, SAI_DateLiv)
  • the code of the report is as follows:
    // Récupère les paramètres passés à l'état et
    // passe des paramètres par défaut pour le test de l'état
    PROCÉDURE ETAT_Param(sDate = Today())
WEBDEV - Server code WEBDEV example The "RPT_Order" report is a report with parameters used to print the order of a customer identified by his customer number. The "RPT_Order" report is displayed in a PDF file. This PDF file is sent to the browser when "BTN_Order" is clicked on.
In this example:
  • the click code of "BTN_Order" is as follows:
    // Génère un nom de fichier unique
    NomFicUnique is string = fWebDir() + "\" + "Facture_" + DateSys() + TimeSys() + ".pdf"
    // Paramètre la destination de l'impression
    iDestination(iPDF, NomFicUnique)
    // Génère le bon de commande
    iPrintReport(ETAT_Commande, CLIENT.CLCLEUNIK)
  • the code of the report is as follows:
    // Récupère les paramètres passés à l'état et
    // passe des paramètres par défaut pour le test de l'état
    PROCÉDURE ETAT_Commande(nIDClient = 450)

Printing a bounded report with parameters based on a data file

To print a bounded report with parameters based on a data file, you must:
  1. Configure the report print destination:
    • WINDEV In WINDEV, with iDestination (report viewer, print in an HTML file, etc.).
    • WEBDEV - Server code In WEBDEV, with iDestination (print in an HTML file, etc.).
    • AndroidiPhone/iPad In Android and iOS, with iDestination (print in a PDF file).
    For more details, see Print modes of a report.
  2. Specify the following parameters with iPrintReport:
    • the name of the report to print.
    • the value of the lower bound for the report.
    • the value of the upper bound for the report.
    • the parameters expected by the report (in the order specified in the report).
WINDEV WINDEV example The "RPT_Param" report corresponds to a mailshot sent to the customers whose name starts with the letter "D" or "E".
The lower bound corresponds to: "D" and the upper bound to: "E".
This report expects as 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 when "BTN_Print" is clicked on. The "RPT_param" report is based on the "Customer" data file.
In this example, the click code of "BTN_Print" is as follows:
// Ouvrir le visualisateur de rapports
iDestination(iViewer)
// Imprimer l'état avec passage de bornes et de paramètres
iPrintReport(ETAT_Param, "D", "E", SAI_TexteMailing, SAI_DateEnv)
AndroidiPhone/iPad Android/iOS example The "RPT_Param" report corresponds to an invoice sent to the customers whose name starts with the letter "D" or with the letter "E".
The lower bound corresponds to: "D" and the upper bound to: "E".
This report expects in parameter the delivery date entered in the edit control named "EDT_DelDate".
This report is printed when "BTN_Print" is clicked on. The "RPT_param" report is based on the "Customer" data file.
In this example, the click code of "BTN_Print" is as follows:
// Paramètre la destination de l'impression
iDestination(iPDF)
// Imprime l'état avec passage de bornes et de paramètres
iPrintReport(ETAT_Param, "D", "E", SAI_DateLiv)
WEBDEV - Server code WEBDEV example The "RPT_Param" report is used to print the invoices of a given customer for the month of January 2004.
The lower bound corresponds to: "01/01/2023" and the maximum limit at: "31/01/2023".
This report expects the customer number as parameter. This report is displayed in a PDF file when "BTN_Print" is clicked on.
In this example, the click code of "BTN_Print" is as follows:
// Génère un nom de fichier unique
NomFicUnique is string = fWebDir() + "\" + "ETAT_Param_" + DateSys() + TimeSys() + ".pdf"
// Paramètre la destination de l'impression
iDestination(iPDF, NomFicUnique)
// Imprime l'état avec passage de bornes et du paramètre
iPrintReport(ETAT_Param, "01012023", "31012023", NumCli)
// Envoie le fichier dans le navigateur
FileDisplay(NomFicUnique, "application/pdf")
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/11/2023

Send a report | Local help