ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Pivot Table control
  • Overview
  • Features of the context menu
  • Deleting columns and rows
  • Collapsing/Expanding columns or rows
  • Granularity: week, fortnight, semester, etc, ...
  • Rearranging headers of rows and columns
  • Transposing rows and columns
  • Comparing date ranges
  • Exporting the Pivot Table control to Excel
  • Loading/Saving the content of the pivot table
  • Restoring the initial size and groups
  • Saving size and groups
  • Settings
  • Settings of the automatic menu in 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
Overview
The Pivot Table control offers several Automatic Application Features (AAF) allowing the user to take advantage of all its capabilities.
The user can:
  • resize the first column of the Pivot Table control with the mouse (column containing the row headers).
  • collapse/expand columns and rows by clicking the header icons "+" and "-".
  • open a context menu to perform several actions on rows and columns.
  • open a context menu for cells.
  • select several rows, columns or cells via the Shift and Ctrl keys. This option is available only if multiple selection is allowed in the control. For more details, see Description of a Pivot Table control.
  • perform a search in the cells of a Pivot Table control by pressing Ctrl + F.
The features of context menu for the rows and columns are as follows:
The features of context menu for the cells are as follows:
Remark: If the Pivot Table control allows for multiple selection, certain operations are available only for the selected rows, columns or cells.
Features of the context menu

Deleting columns and rows

Some pivot tables can contain a great number of rows and columns (if the control contains several hierarchy levels, for example).
To get a more concise display, you can:
  • delete the current column.
  • delete all the columns identified with the same information. For example, in a pivot table presenting calculations over several years, you have the ability to delete the month of February for all the years displayed in this table.
  • delete all the columns except for the columns identified with the same information. For example, in a pivot table presenting calculations over several years, you have the ability to display the months of February for each year. All the other months will be deleted.
This display mode is also available for rows.
When a row or column is deleted, the content of the pivot table is recalculated: the totals are updated.
The deleted columns and/or rows can be redisplayed at any time (via the "Redisplay all deleted columns" option, for example). When the rows or columns are redisplayed, the content of the pivot table is recalculated: the totals are updated.
Caution: If a column or a row is not repeated, only the selected column or row will be deleted.

Collapsing/Expanding columns or rows

For a Pivot Table with many elements and subelements, you can:
  • collapse or expand all the columns and/or rows in a single action.
  • expand a level and all its sublevels in a single action (in columns or rows).
For example:
  • If all the columns are expanded, the pivot table displays all the details: all the levels of detail are visible, from the highest to the lowest.
  • If all the columns are collapsed, the pivot table hides the details: it only shows the calculations of the first level.

Granularity: week, fortnight, semester, etc, ...

If the pivot table does not contain enough details, you can add columns to enhance statistics.
The context menu of the columns includes the "Granularity" option. This option allows you to add groups, for example: Semester, Quarter, Fortnight, etc.
Caution: this option recalculates the pivot table. If several operations must be performed, the data calculation can be deferred.

Rearranging headers of rows and columns

This option is used to change the display mode of rows and columns in the Pivot Table control.
When this option is selected, the pivot table becomes editable.
You can:
  • make rows or columns visible or not.
    To show elements, simply select the hidden elements in "Headers not displayed" and move them to the desired location in the rows or columns.
    To hide elements, simply select the corresponding header and move it to "Headers not displayed".
  • reverse the dimensions. Simply drag and drop the header onto the desired position.

Transposing rows and columns

This option rearranges the data of the Pivot Table control. Columns switch to rows and vice versa.
Remark: To programmatically transpose data from rows to columns, and vice versa in a Pivot Table, use AAFExecute with the aafPvtReverseRowColumn constant.

Comparing date ranges

This option is used to compare the data displayed in the Pivot Table control over 2 date ranges.
When this option is selected:
  • A window appears, allowing you to enter the characteristics of the comparison:
    This comparison will take into account the reference date range specified in this window; not the date range currently displayed in the Pivot Table control.
    • Reference date range.
    • Previous date range for comparison.
    • Evolution between years.
  • When this window is validated, the data is recalculated to show only the data in the comparison. For example:

    If the evolution between years must be shown, it will appear in green or red, depending on whether it is positive or negative. The context menu of the data includes the following two options to improve the comparison:
    • Show evolutions.
    • Show evolutions in %.
To restore the standard Pivot Table control, select "Cancel date range comparison" in the context menu.
Remark: To compare date ranges through programming, use AAFExecute with the aafCompareDateRangePvt constant.

Exporting the Pivot Table control to Excel

This option is used to export the content of the pivot table to Excel. This option corresponds to PVTToExcel. All you have to do is specify the name of the XLS file to create. The created document can be directly opened. The new XLS document contains the data of the pivot table. The hidden or collapsed columns will not be visible in the XLS file.

Loading/Saving the content of the pivot table

To avoid recalculating a pivot table displayed previously, the content of the control can be saved to a file on disk. This will allow users to open it later or send it to someone else. This option corresponds to PVTSave.
The created file can be re-opened later (equivalent to PVTLoad).
Caution: The created file can only be opened on the same kind of pivot table (with matching columns and rows).
Remark: The backup file can be encrypted using a password.
  • When saving the file, simply check "Encrypt with password" when typing the name of the backup file. In this case, a new window will prompt you to enter the password to be used:
  • When you load the encrypted file, the same window will appear again. Simply specify the corresponding password.
The password input window is available in English and in French.

Restoring the initial size and groups

This option is used to restore the default settings of the pivot table.

Saving size and groups

This option saves the last settings of the pivot table. Thus, the next time the window is opened, these settings will be automatically applied.
The user no longer has to configure the control each time it is displayed.
Context menu of a cell: changing the background color
The context menu of a cell allows the user to easily change the color of a cell in the Pivot Table control. This makes it easier to identify important elements in the pivot table.
Tip: The last color used is automatically proposed in the context menu of the cell. This feature is useful to apply the same color to multiple cells.
When saving the content of the pivot table (with UI), the specified colors are saved.
Settings

Settings of the automatic menu in a Pivot Table control

The context menu of a Pivot Table control can be disabled. To configure the display of the context menu, you must:
  1. Open the description window of the Pivot Table control.
  2. Select the "UI" tab.
  3. Choose the desired menu in the "Context menu" combo box. You can:
    • "Display the AAF menu (System)": In this case, the automatic menu of the Pivot Table control will be used (AAF menu). For more details on how to configure this menu, see Configuring the AAF menu.
    • "Add a context menu": If this option is checked, you can select the custom context menu to be displayed.
Remarks:
  • If both options are checked, the custom context menu can be added before or after the AAF menu.
  • If no option is selected, no context menu will be selected. The <Disabled> option will be displayed in the description window.
  • The ContextMenu property is also used to remove the AAF-specific context menu and restore the standard Windows menu for a given control.
Minimum version required
  • Version 18
Comments
Click [Add] to post a comment

Last update: 09/13/2023

Send a report | Local help