ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Pivot Table control
  • How to create the Pivot Table control (in a window)?
  • Wizard for creating a Pivot Table control
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
How to create the Pivot Table control (in a window)?
To create a Pivot Table control in a window:
  1. On the "Creation" tab, in the "Data" group, expand "Table and List Box" and select "Pivot Table (PVT)".
  2. Click at the desired location to create the control. The control creation wizard starts. This wizard is used to define the main elements of the pivot table.
  3. At the end of the wizard, the Pivot Table control is automatically created with the Button control used ti fill it at runtime.
Remarks:
  • The Pivot Table control works:
    • on the HFSQL databases,
    • on other databases via arrays of structures.
  • The content of the Pivot Table control can be printed via its context menu. For more details, see Printing the content of a Pivot Table control (AAF).
  • You can create a report based on a Pivot Table control. For more details, see Pivot Table report.
Wizard for creating a Pivot Table control
The Pivot table control creation wizard is used to define the main elements of the table.
  1. First, the wizard is used to define the values displayed in the cells of the pivot table. A cell found in a pivot table can display for example the total sales, the sum of quantities, the number of orders, ...
    Therefore, you must define for each value displayed in the cell:
    • the source file. This file corresponds to the file containing the value used for the calculation. For example, the OrdLine file to calculate the sales performed.
    • the calculation displayed. Several calculations are available: sum, mean, count, ...
    • the source for the calculation, which means the item of the source file to use. For example, to calculate the sales performed, the sum will be performed on the sale price (Total_Row item of OrdLine file).
      The "Add an additional value" button is used to define a new value that will be displayed in the cell.
      Remarks:
      • The Pivot Table control can be based on a query. In this case, the source file corresponds to the query.
      • The Pivot Table control can be based on an Array of Structures variable. In this case, the source file corresponds to the variable.
  2. The next step consists in defining the column header of the Pivot Table control. The column header comes firectly from your data files.
    One or more column headers can be found.
    For each column header, the header lets you define:
    • the link used to access the item displayed in the header. This link is performed from the data file used for the source of calculation.
    • if the column header corresponds to a Date item, the wizard proposes the display mode of the date: Year, Half-year, Quarter, Month, Fortnight, Week, Day. A new grouping will be performed for each selected display mode. For example, if only the years, quarters and months are displayed, the column header will look like this:
      Remarks:
      • If the Pivot Table control is based on a query, the data displayed in the column header comes directly from the query.
      • If the Pivot Table control is based on an Array of Structures variable, the data displayed in the column header comes from the members of the structure.
  3. The next step consists in defining the row header of the Pivot Table control. The row header comes from your data files.
    One or more row headers can be found.
    For each row header, the wizard lets you define:
    • the link used to access the item displayed in the header. This link is performed from the data file used for the source of calculation.
    • if the row header corresponds to a Date item, the wizard proposes the display mode of the date: Year, Half-year, Quarter, Month, Fortnight, Week, Day. A new grouping will be performed for each selected display mode.
      Remarks:
      • If the Pivot Table control is based on a query, the data displayed in the row header comes directly from the query.
      • If the Pivot Table control is based on an Array of Structures variable, the data displayed in the row header comes from the members of the structure.
  4. Give a name to the Pivot Table control and validate.
    Remark: The dimensions of the control are optimized to take up the available space at the specified position. If the control size does not suit you, press Ctrl + Z: the control size will be reset to default.
The Pivot Table control is created in the window with a "Calculate" Button control. This Button control is used to start the calculation of the Pivot Table control.
Caution: If the source of the Pivot Table control is:
  • a query, the query must be run before calculating the Pivot Table control.
  • an array of structures, the array of structures must be filled before calculating the Pivot Table control.
To modify the characteristics of the Pivot table control, display the control description ("Description" in the context menu). For more details, see Description of a Pivot Table control.
Related Examples:
WD PivotTable Training (WINDEV): WD PivotTable
[ + ] This example presents the use of the Pivot Table control.

This Pivot Table control is used to display dynamic statistics while grouping the data.
These statistics are calculated form the database.
Minimum version required
  • Version 18
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help