PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Overview
  • Creating a report on a programmed data source
  • Overview
  • Creating a report on a programmed data source
  • Programming the reading of records
  • Order of execution of the different WLanguage events
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 a programmed data source
Overview
In a report on a programmed data source, the reading of the records that will be displayed in the report requires full programming in WLanguage. The data source can have any type (HFSQL file, query, text file, file from an external database, ...).
The creation of a report based on a programmed data source is performed by the wizard for report creation ("File .. New .. Report").The creation of a report based on a programmed data source is performed by the wizard for report creation.
When the report based on a programmed data source is created, you can:
  • modify the data source of report ("Data" tab of report description).
  • add or delete Item controls linked to the data source of the report.

Important

Reports & Queries does not allow you to create reports based on a programmed data source. However, you have the ability to customize the reports on a programmed data source created in the standard report editor (color, fonts, size, ...).
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.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Creating a report on a programmed data source

Overview

Two steps are required to create a report based on a programmed data source:
  1. Creating the report with the creation wizard.
  2. Programming the reading of records.

Creating a report on a programmed data source

To create a report on a programmed data source:
  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 the data source of the report ("I program the reading of my data source").Select the data source of the report ("Other (programing, text file, memory zone, HyperFileSQL view)"). Then, select "I program the reading of my data source".Select the data source of the report ("Other (programing, text file, memory zone, HFSQL view)"). Then, select "I program the reading of my data source".
  4. For each type of report, specify the corresponding specific options.
    Type of reportSpecific options
    Table report
    • specify the number of columns found in the table.
    • for each column, specify the caption and type of the printed value.
    • modify (if necessary) the order of the different columns.
    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
    Table report
    • specify the number of columns found in the table.
    • for each column, specify the caption and type of the printed value.
    • modify (if necessary) the order of the different columns.
    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.
  5. Specify the format of sheet on which the report will be printed. The report is printed in A4 format by default.
  6. Select the skin template of report if necessary.
  7. Enter the name and title of the report. This name (".WDE". file corresponding to the report) will be used to identify the report in your programs.
  8. Validate the report creation.
  9. If the report contains a table, the report editor automatically proposes to change the format of the report and/or to reduce the size of the table if some of the table columns cannot be printed in the report.
  10. 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.
  11. The report currently created is displayed in the report editor.

Programming the reading of records

The programming required to read the records is presented in the following example:

Example

The information to print is in the HFSQL data file named "Customer". The data is displayed in the item controls.
The following method is used to program the reading of records:
  1. Reading the first record of the "Customer" data file in the event "Report opening" (HReadFirst).
    // Read the first record of "Customer" data file
    HReadFirst(Customer, CustomerNum)
  2. The event "Reading data" of the report is used to manage the end of the data file. The following values are returned according to the case:
    • True: end of file not reached (step 3 is run).
    • False: end of file reached (step 3 is not run).
      // End of "Customer" data file reached?
      IF HOut() = True THEN
      // Stop printing the Body block
      RESULT False
      ELSE
      // Print the Body block and run its events
      RESULT True
      END
  3. The event "Before printing" of the Body block is used to manage the records of the data file:
    • Assigning the values of items in the report controls.
    • Reading the next record.
      // Assign the values of items in the report controls
      ITEM_Company = Customer.Company
      ITEM_Name = Customer.CustomerName
      ITEM_Address = Customer.Address
      ITEM_ZC = Customer.ZC
      ITEM_City = Customer.City

      // Read the next record
      HReadNext(Customer)
  4. The event "After printing" of the Body block is used to manage a page break, should each page contain a single Body block.
    Note: In the description window of the Body block, the option "Page break after the block" is not applied for a report based on a programmed data source.
    // Page break as long as records are still found
    IF HOut() = False THEN
    iPageEnd()
    END

Order of execution of the different WLanguage events

The order in which the different WLanguage events are executed to read the records is presented in the following table:
Order of execution of report eventsProgramming required to read the data
1. Opening the reportReading the first record (HReadFirst for example).
2. Reading the report dataManaging the end of the data file.
3. Before printing the Body blockAssigning the values of items in the report controls and reading the next record (HReadNext for example).
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment