PC SOFT

WINDEV的在线文档

  • Overview
  • Creating a report on a data file
  • Bounded report based on a data file
  • Defining a bounded report
  • Printing a report 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
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Report 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 on query.

Note: From version 19, HFSQL is the new name of HyperFileSQL.

Characteristics of a report on a data file
The characteristics of a report on a data file are as follows:
  • Search key: a report on a data file is using 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 on a data file can be bounded. These bounds are used to define the range of records that will be printed in the report. See Bounded report based on a data file for more details.
The creation of a report on a data file is performed by the wizard for report creation. This type of report can be created only if the current project is associated with an analysis.

Once the report on a data file is created, you can:

  • modify the data source of the report ("Data" tab of the report description).
  • modify the search key ("Data" tab of the report description).
  • define the bounds ("Data" tab of the report description).
  • add or delete Item controls linked to the data file associated with the report.

ImportantThe 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.
See Preparing a WinDev application in order to use it with Reports & Queries for more details.

This help page presents:

Creating a report on a data file
To create a report on a data file:
  1. Select "File .. New .. Report". The wizard for report creation starts.Clickamong 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: "from an existing file or query".
  5. Select the data file on which the report is based. The description of this file must be found 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 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. 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. For each file item displayed in the report:
    • enter the corresponding caption. This caption will be displayed:
      • before the item. For example:
      • in the header of the column (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 must be printed. The positions of the 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 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
    Type of report: Table + ChartType of the chart, aspect of the chart, ...
    Options presented in Table + Chart report
    Chart reportType of the chart, aspect of the chart, ...
    Options presented in Chart report
    Report on formImage of the form, print the image of the form, ...
    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 formImage of the form, print the image of the form, ...
    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 the report.
  14. Select the skin template of the report if necessary.
  15. Enter the name and title of the report (name of the ".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 format of the report 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:
    • 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.
      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 size of the report. 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 "Customer" file can print all the customers or only the customers whose name starts with the letter "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 打印报表, or with ..最小界限 and ..最大界限. See Printing a bounded report for more details.
Note: When running the test of a bounded report ("Code .. Run the report test"), a window allows you to enter the bounds of the report.Note: When running the test of a bounded report (among the quick access buttons), a window allows you to enter the bounds of the report.

Printing a report on a data file
To print a report on a data file, you must:
  1. Configure the destination of the report print:
  2. Specify the name of the report to print with 打印报表.
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.

ImportantIn Reports & Queries, a report can be printed:
  • by starting a print ().
  • by running the report test ().
Therefore, no programming is required to print the report.

WinDev WinDev and WinDev Mobile examples

The "RPT_Customer" report is based on the "Customer" file. This report is used to print the characteristics of customers.

The "RPT_Customer" report is printed during a click on the "BTN_Customer" button. In this example, the click code of "BTN_Customer" is as follows:

WinDev WinDev code:

// Open the preview window
打印预览()
// Print the RPT_Customer report
打印报表RPT_Customer

Note: ..数据源名称 used in the report code allows you to find out 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 destination of the report print:
  2. Specify the following parameters with 打印报表:
    • 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.
WinDev WinDev and WinDev Mobile example

The "RPT_Customer" report is a bounded report based on the "Customer" 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.

The "RPT_Customer" report is printed when clicking the "BTN_CustomerD" button.

In this example, the click code of "BTN_CustomerD" is as follows:

WinDev WinDev code:

// Open the preview window
打印预览()
// Print the RPT_Customer report
打印报表RPT_Customer"D""D"+h.最大值

Printing a report with parameters based on a data file

To print a report with parameters, parameters must be passed to the report. See the Reports with parameters for more details.

To print a report with parameters based on a data file, you must:

  1. Configure the destination of the report print:
  2. Specify the following parameters with 打印报表:
    • 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 in 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 the "BTN_Print" button is clicked. The "RPT_param" report is based on the "Customer" file.

In this example:

  • the click code of the "BTN_Print" button is as follows:
    // Open the preview window
    打印预览()
    // Print the report while passing parameters
    打印报表RPT_ParamEDT_MailingTextEDT_SendDate
  • the code of the report is as follows:
    // Retrieve the parameters passed to the report and
    // pass the default parameters for the report test
    过程REPORT_ParamsText"Default"sDate今天())

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 destination of the report print:
  2. Specify the following parameters with 打印报表:
    • 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 letters "D" or "E".

The lower bound corresponds to: "D" and the upper bound to: "E".

This report expects in 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 the "BTN_Print" button is clicked. The "RPT_param" report is based on the "Customer" file.

In this example, the click code of the "BTN_Print" button is as follows:

// Open the preview window
打印预览()
// Print the report while passing bounds and parameters
打印报表RPT_Param"D""E"EDT_MailingTextEDT_SendDate