PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Creating a report on a memory zone
  • Printing a report on a memory zone
  • WINDEV example
  • WEBDEV example
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Report on memory zone
Overview
A report on a memory zone is used to print the records stored in a memory zone. The memory zone must necessarily contain all the numbers of the records that must be printed.
Note: This type of report is not available in WINDEV Mobile.
Characteristics of a report on a memory zone:
  • a report on a memory zone is linked to the base data file of this memory zone. The report is used to print the records coming from this base data file.
  • the order in which the records are printed corresponds to the order of the record numbers found in the memory zone.
You can for example:
  • store in a memory zone the numbers of the records selected by one or more processes.
  • print the records only when the selection is performed.
The creation of a report on a memory zone is performed via the wizard for report creation ("File .. New .. Report").The creation of a report on a memory zone is performed via the wizard for report creation.
To run the test of a report on a memory zone, you must:
  • create and initialize the memory zone.
  • print the report.
When the report on a memory zone is created, you can:
  • modify the data source of report ("Data" tab of report description).
  • add or delete Item controls linked to the memory zone associated with the report.

Important

Reports & Queries does not allow you to create reports based on a memory zone. However, you have the ability to customize the reports on a memory zone created in the standard report editor (color, font, size, ...).
Creating a report on a memory zone
To create a report on a memory zone:
  1. Select "File .. New .. Report". The wizard for report creation starts.Click among the quick access buttons.
    • Click "Report" in the wheel that is displayed. The window for creating a new element is displayed: click "Report" then "Report".
    • The wizard for report creation starts.
  2. Choose the layout of your report (table, form, label, ...). See The different types of reports for more details.
  3. Select (if necessary) the report template to use. A report template is used to comply with a specific page layout. See The report templates for more details.
  4. Select the data source of the report ("Other (programming, text file, memory zone, HyperFileSQL view, ..." option).Select the data source of the report ("Other (programming, text file, memory zone, HFSQL view, ..." option).
  5. Select the type of data source ("From a memory zone that was filled by programming").
  6. Select the base data file of the memory zone associated with the report.
  7. Select the sort items for the report. These items will be used to sort the data printed in the report. See Sorts in a report for more details.
  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 breaks to the report?".
    The next step is used to select the sort items corresponding to the breaks. See Breaks in a report for more details.
  9. Select the items displayed in the report. Only the controls linked to the items of the memory zone will be filled.
    For each file item displayed in the report:
    • type the corresponding caption. This caption will be displayed:
      • before the item. For example:
      • in the column header (for the Table reports). For example:
        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. See Report blocks for more details.
  10. Modify (if necessary) the display order of the controls in the report with the arrow buttons found on the right of the table.
  11. If the base data file of the memory zone 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.
  12. Depending on the type of report currently created, indicate the specific options.
    Type of reportSpecific options
    Type of report: Table + ChartType of chart, aspect of chart, ...
    Options presented in Table + Chart report
    Chart reportType of chart, aspect of chart, ...
    Options presented in Chart report
    Report on formForm image, printing the form image, ...
    Options presented in Report on form
    Label reportFormat of labels, number of identical copies, ...
    Options presented in Label report

    Type of reportSpecific options
    Report on formForm image, printing the form image, ...
    Options presented in Report on form
    Label reportFormat of labels, number of identical copies, ...
    Options presented in Label report
  13. Specify the format of the sheet on which the report will be printed. The report is printed in A4 format by default.
    Note: By default, the report controls are displayed in a single column. To create a multi-column report, the requested number of columns must be specified in the "Format" tab of the description window of report.
  14. Select the skin template of report if necessary.
  15. Type the name and title of report (name of ".WDE" file corresponding to the report). This name will be used to identify the report in your programs.
    WINDEV You also have the ability to 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 the table columns.
  18. 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. See Multi-page print for more details.
      New in version 19
      Print the report on several pages. In this case, the end user will have to group the pages. See Multi-page print for more details.
      Print the report on several pages. In this case, the end user will have to group the pages. See Multi-page print for more details.
    • 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.
Printing a report on a memory zone
To print a report on a memory zone:
  1. Create the memory zone with MemCreate.
  2. Add records into the memory zone with MemAdd and sort these records (if necessary) with MemSort.
  3. Configure the destination of the report print with iPreview (print preview, print in an HTML file, ...). See Print modes of report for more details.
  4. Specify the following parameters with iPrintReport:
    • the name of the report to print.
    • the name of the memory zone used.
  5. Delete the memory zone with MemDeleteAll at the end of report print.
Notes:
  • To optimize the resources used on a Pocket PC, printing a report based on a memory zone is not available in WINDEV Mobile.
  • If additional parameters must be passed to the report, these parameters must be specified in iPrintReport, after the name of the memory zone. See Report with parameters for more details.
  • ..MemZoneName used in the code of the report allows you to find out and modify the name of the memory zone associated with the report.
  • ..SourceName used in the code of the report allows you to find out and modify the name of the base file of the memory zone associated with the report.

Important

In Reports & Queries, a report can be printed:
  • by starting a print ( ).
  • by running the report test ( or "Code .. Run the report test").by running the report test ( ).
Therefore, no programming is required to print the report.
WINDEVReports and Queries

WINDEV example

The user selects the customers to whom a promotional offer must be sent. The name of the selected customers is found in the List Box control named "Recipient".
Once all the customers have been selected, the Web user clicks the "BTN_Print" button to print the "RPT_MemZone" report.
During a click on the "Print" button:
  • the memory zone named "MemZone" is created.
  • the record number of each selected customer is retrieved and added to "MemZone".
  • the "RPT_MemZone" report is printed.
  • the memory zone named "MemZone" is deleted.
In this example, the click code of "BTN_Print" button is as follows:
nSubscript is int
// Create the memory zone
MemCreate("MemZone")
// Browse the Recipient list and initialize the memory zone
FOR nSubscript = 1 _TO_ Recipient..Occurrence
        // Find the current record
        HReadSeek(Customer, Name, Recipient[nSubscript])
        IF HFound(Customer) = True THEN
                // Add the elements into the memory zone
                MemAdd("MemZone", "", HRecNum())
        END
END
// Open the preview window
iPreview()
// Print the report
iPrintReport(RPT_MemZone, "MemZone")
// Destroy the memory zone
MemDeleteAll("MemZone")
WEBDEV - Server code

WEBDEV example

The Web user selects the customer to whom a promotional offer must be sent. The name of the selected customers is found in the List Box control named "Recipient".
Once all the customers have been selected, the user clicks the "Print" button to print the "RPT_MemZone" report.
During a click on the "BTN_Print" button:
  • the memory zone named "MemZone" is created.
  • the record number of each selected customer is retrieved and added to "MemZone".
  • the "RPT_MemZone" report is displayed in a PDF file.
  • the memory zone named "MemZone" is deleted.
In this example, the click code of "BTN_Print" button is as follows:
nSubscript is int
// Create the memory zone
MemCreate("MemZone")
// Browse the Recipient list and initialize the memory zone
FOR nSubscript = 1 _TO_ Recipient..Occurrence
// Find the current record
HReadSeek(Customer, Name, Recipient[nSubscript])
IF HFound(Customer) = True THEN
// Add the elements into the memory zone
MemAdd("MemZone", "", HRecNum())
END
END
// Generates a unique file name
UniqueFileName is string = fWebDir() + "\" + "RPT_MemZone_" + ...
DateSys() + TimeSys() + ".pdf"
// Configures the print destination
iDestination(iPDF, UniqueFileName)
// Prints the report
iPrintReport(RPT_MemZone, "MemZone")
// Destroy the memory zone
MemDeleteAll("MemZone")
// Sends the file to the browser
FileDisplay(UniqueFileName, "application/pdf")
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 required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment