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.
  • Overview
  • Creating a report on variable
  • Printing a report on a variable
  • Printing a report on a variable
  • WINDEV and WINDEV Mobile examples
  • WEBDEV example
  • Remarks
  • Printing a report with parameters based on a variable
  • WINDEV and WINDEV Mobile example
  • WEBDEV example
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 on variable (Data binding)
Overview
A report on variable is used to directly print the information found in a WLanguage variable. This variable can be:
  • a variable global to the project,
  • a variable global to a window or to a page.
  • a variable global to a set of procedures.
This variable can be a simple array, a class member, a structure member or an advanced variable member.

Important

Reports & Queries cannot be used to create or modify reports on variable.
Versions 18 and later
iPhone/iPad This feature is now available for iPhone/iPad applications.
New in version 18
iPhone/iPad This feature is now available for iPhone/iPad applications.
iPhone/iPad This feature is now available for iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Creating a report on variable
To create a report on variable:
  1. Click among the quick access buttons.
    • The element creation window appears: click "Report" then "Report".
    • The report creation wizard starts.
  2. In the wizard, 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. See Report templates for more details.
  4. Select the data source of report ("From an existing variable").
  5. Select the array variable on which the report will be based. Only the variables global to the project or to the windows found in the current application are proposed.
  6. To group the records, you have the ability to create breaks on the array elements. To create breaks, answer "Yes" to the question "Do you want to add some breaks into the report?".
    The following plane is used to select the variables corresponding to the breaks.
    Caution: Before printing the report, the array variable must be sorted through programming according to the break variable. This sort will be performed by Sort.
    For more details on breaks, see Breaks in a report.
  7. Select the variables that must be displayed in the report. Modify (if necessary) the display order of controls in the report with the arrow buttons found on the right of the list.
  8. Select the block where each variable will be displayed.. You also have the ability to rename the control caption.
    Remark: By default, the controls associated with the variables are displayed in the Body block. By default, the control caption corresponds to the variable name. This caption can be modified in the report editor.
  9. If the variable associated with the report contains at least one numeric item, you have the ability to perform calculations 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.
  10. Depending on the type of report currently created, indicate the specific options.
    Type of reportSpecific options
    Report on formForm image, printing the form image, ...
    Options presented in detail in Report on form
    Label reportFormat of labels, number of identical copies, ...
    Options presented in detail in Label report
  11. 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.
  12. Select the skin template of the report if necessary.
  13. Type the name and title of the report (name of ".WDE" file corresponding to the report). This name will identify the report in your programs.
  14. Validate the report creation.
  15. 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.
  16. Specify (if necessary) the mode for reducing the report size:
    • Versions 19 and later
      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.
      New in version 19
      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.
      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.
  17. The report currently created is displayed in the report editor.
Printing a report on a variable

Printing a report on a variable

To print a report on variable, you must:
  1. Initialize the value of variable used.
  2. Sort the array if necessary (with ArraySort for example).
  3. 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, ...).
    For more details, see Print modes of a report.
  4. Specify the name of the report to print with iPrintReport.
If necessary, additional parameters can be specified when printing a report with parameters based on a variable. For example, the name of the array variable to use can be passed as parameter. In this case, the report is a report with parameters based on an array variable (see the following paragraph).

Important

In Reports & Queries, you can print a report:
  • by starting a print job ( ).
  • by testing the report ( ).
Therefore, no programming is required to print the report.
WINDEVWINDEV Mobile

WINDEV and WINDEV Mobile examples

The "RPT_gglEvent" report is based on the MyEvents variable (gglEvent type). This report is used to print the list of events found in a Google calendar.
The "RPT_gglEvent" report prints during a click on the "BTN_Event" button. In this example, the click code of "BTN_Event" button is as follows:
  • WINDEV WINDEV code:~
    // Ouvrir le visualisateur de rapports
    iDestination(iViewer)
    // Imprimer l'état ETAT_gglEvenement
    iPrintReport(ETAT_gglEvenement)
WEBDEV - Server code

WEBDEV example

The "RPT_gglEvent" report is based on the MyEvents variable (gglEvent type). This report is used to print the list of events found in a Google calendar.
"RPT_gglEvent" is displayed in a PDF file when "LINK_Event" is clicked on. Then, the PDF file is displayed in the browser. In this example, the server click code of "LINK_Event" is as follows:
// Génère un nom de fichier PDF unique
NomFicUnique is string
NomFicUnique = fWebDir() + "\" + "ETAT_gglEvenement_" + DateSys() + TimeSys() + ".pdf"
// Paramètre la destination de l'impression
iDestination(iPDF, NomFicUnique)
// Imprime l'état ETAT_gglEvenement
iPrintReport(ETAT_gglEvenement)
// Envoie le fichier dans le navigateur
FileDisplay(NomFicUnique, "application/pdf")
// Supprime le fichier
fDelete(NomFicUnique)

Remarks

  • SourceName used in the report code allows you to find out and change the name of the variable associated with the report.
  • DisplayedItem used in the report code allows you to find out and change the name of the variable associated with the item.

Printing a report with parameters based on a variable

To print a report with parameters, parameters must be passed to the report. For more details, see Reports with parameters .
To print a report with parameters based on a variable, you must:
  1. Initialize the value of array variable used.
  2. Sort the array if necessary (with ArraySort for example).
  3. Configure the report print destination:
  4. Specify the following parameters using the iPrintReport function:
    • the name of the report to print.
    • the parameters expected by the report (in the order specified in the report).
WINDEVWINDEV Mobile

WINDEV and WINDEV Mobile example

A window lists the organizers and their events. The "RPT_gglEvent" report is printed when the Button control "Print the organizer events" is clicked on. This report expects as parameter the organizer for which the events will be listed.
WINDEV WINDEV code:
  • the click code of the Button control "Print the organizer events" is as follows:
    // Ouvrir le visualisateur de rapports
    iDestination(iViewer)
    // Imprimer l'état avec le passage des paramètres
    iPrintReport(ETAT_gglEvenement, Agenda[1])
  • the code of the report is as follows:
    // Récupérer les paramètres passés à l'état
    PROCÉDURE ETAT_gglEvenement(MonAgenda)
WEBDEV - Server code

WEBDEV example

The "RPT_gglEvent" report is displayed in a PDF file during a click on the "Print the organizer events" link. Then, the PDF file is displayed in the browser. This report expects as parameter the organizer for which the events will be listed.
In this example:
  • the click code of the Button control "Print the organizer events" is as follows:
    // Génère un nom de fichier unique
    NomFicUnique is string = fWebDir() + "\" + "Evenementggl_" + DateSys() + TimeSys() + ".pdf"
    // Paramètre la destination de l'impression
    iDestination(iPDF, NomFicUnique)
    // Génère l'état
    iPrintReport(ETAT_gglEvenement, MonAgenda)
    // Envoie le fichier dans le navigateur
    FileDisplay(NomFicUnique, "application/pdf")
    // Supprime le fichier
    fDelete(NomFicUnique)
  • the code of the report is as follows:
    // Récupérer les paramètres passés à l'état
    PROCÉDURE ETAT_gglEvenement(MonAgenda)
Related Examples:
WD Reports Training (WINDEV): WD Reports
[ + ] This example presents the different methods for creating a report:

- prints based on different data sources (queries, variables, ...)
- prints based on controls (Table, Spreadsheet, PVT, ...)
- printing composite reports
- specific prints (portrait/landscape, report with watermark, report with bar code, ...)
Minimum version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment