PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Creating a report based on an HFSQL view
  • Printing a report based on an HFSQL view
  • To print a report based on an HFSQL view
  • WINDEV 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 based on an HFSQL view
HFSQLHFSQL Client/ServerAvailable only with these kinds of connection
Overview
A report based on an HFSQL view is used to print records from an HFSQL Classic or Client/Server view.
Reminder: An HFSQL view corresponds to a "memory image" of a data file. A view is stored in memory, which insulates it from the modifications made to the associated data file. Once created, a view can be handled like any HFSQL data file. For more details, see The HFSQL views.
Characteristics of a report based on an HFSQL view:
  • a report based on an HFSQL view is linked to the base file of this HFSQL view. The report is used to print the records coming from this base file.
  • the order in which the records are printed corresponds to the order of the records found in the HFSQL view (defined when creating the view or by HSortView).
A report based on an HFSQL view can be created via the report creation wizard
When the report based on an HFSQL view is created, you can:
  • modify the data source of the report ("Data" tab in the report description).
  • add or delete Item controls linked to the HFSQL view associated with the report.

Important

Reports & Queries cannot be used to create reports based on an HFSQL view. However, you have the ability to customize the reports based on an HFSQL view created in the standard report editor (color, fonts, size, ...).
Creating a report based on an HFSQL view
To create a report based on an HFSQL view:
  1. Click in the quick access buttons.
    • The creation 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 data source of the report ("Other (programming, text file, memory area, HFSQL view, ..." option).
  5. Select the type of data source for the report ("From an HFSQL view").
  6. Select the base data file of the HFSQL view associated with the report.
  7. Select the items displayed in the report. Only the controls linked to the items of the HFSQL view will be filled.
    For each 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. For more details on the different blocks and their position in a report, see Report blocks.
  8. Modify (if necessary) the display order of controls in the report with the arrow buttons found on the right of table.
  9. If the HFSQL view associated with the report contains at least one numeric item, you have the ability to perform calculations 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 (useless in this type of report).
  10. 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
  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 be used to identify the report in your programs.
    WINDEV You can also specify whether the report can be modified by the end user in "Reports & Queries".
  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:
    • 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 based on an HFSQL view

To print a report based on an HFSQL view

  1. Create the HFSQL view with HCreateView (or with HMergeView).
  2. 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.).
    For more details, see Print modes of a report.
  3. Specify the following parameters with iPrintReport:
    • the name of the report to print.
    • the name of the HFSQL Classic view used.
Remarks:
  • The HFSQL view must be created and initialized before printing the report. Only an HFSQL Classic or Client/Server view can be used.
  • If additional parameters must be passed to the report, these parameters must be specified in iPrintReport, after the name of the HFSQL view used. For more details, see Report with parameters.
  • When used in the code of the report, the ViewName property allows you to get and change the name of the HFSQL view associated with the report.
  • When used in the code of the report, the SourceName property allows you get and change the name of the base data file of the HFSQL view associated with the report.

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.
WINDEVReports and Queries

WINDEV example

The user selects the reference of an order in a list. "BTN_Print" allows you to:
In this example, the click code of "BTN_Print" is as follows:
// Create view
IF HCreateView("OrderView", OrdLine, "*", "Reference", "", "", ...
hViewExclusive + hViewBreakable) = False THEN
Error(HErrorInfo())
ELSE
// Open report viewer
iDestination(iViewer)
// Print the RPT_View report
iPrintReport(RPT_View, "OrderView")
END
WEBDEV - Server code

WEBDEV example

The Web user selects the reference of an order in a list. "BTN_Print" allows you to:
  • create the HFSQL view named "OrderView" that contains the order lines (HCreateView).
  • print the "RPT_View" report in a PDF file (iPrintReport).
In this example, the click code of "BTN_Print" is as follows:
// Create view
IF HCreateView("OrderView", OrdLine, "*", "Reference", "", "", ...
hViewExclusive + hViewBreakable) = False THEN
Error(HErrorInfo())
ELSE
// Generate a unique file name
UniqueFilename is string = fWebDir() + "\" + "REPORT_View_" + ...
DateSys() + TimeSys() + ".pdf"
// Configure the destination of the print
iDestination(iPDF, UniqueFilename)
// Print the RPT_View report
iPrintReport(RPT_View, "OrderView")
// Send the file to the browser
FileDisplay(UniqueFilename, "application/pdf")
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment