PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Overview
  • Handling the Pivot Table control by programming
  • Coloring the values
  • Adding a column or row title
  • Making a value invisible
  • Finding out and modifying the mask used to display values
  • Modifying the axes displayed
  • Modifying the data source
  • Progress of calculation
  • Properties specific to the management of Pivot Table controls
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
Handling a Pivot Table control by programming
Overview
A Pivot Table control can be handled by programming.
To handle a Pivot Table control by programming, WINDEV proposes the PVT functions.
This help page explains how to handle a Pivot Table control by programming.
Handling the Pivot Table control by programming

Coloring the values

From the popup menu of the Pivot Table control, the end user can easily color a value in order to highlight it. See Automatic features of Pivot Table controls for more details.
By programming, you have the ability to access the values in order to modify their style (text or background color, ...). To do so, modify the properties of values in the "Cell display" process.
For example:
// If the turnover is less than 500, displays the value in red
IF VAL_TO <= 500 THEN
VAL_TO..BrushColor = PastelRed
END
Versions 20 and later
Note: You have the ability to customize the style of each cell element: color, font, background color, ... via several properties. See Properties associated with the values of a Pivot Table control for more details.
New in version 20
Note: You have the ability to customize the style of each cell element: color, font, background color, ... via several properties. See Properties associated with the values of a Pivot Table control for more details.
Note: You have the ability to customize the style of each cell element: color, font, background color, ... via several properties. See Properties associated with the values of a Pivot Table control for more details.
Versions 19 and later

Adding a column or row title

By default, the rows or columns of a Pivot Table control have no title. You have the ability to add one with ..Caption used on the header name.
For example:
  • Pivot table not displaying a title:
  • Pivot table with a title:
The following code is used:
// Initialize PVT_Stats
COL_Continent..Caption = "Continent"
COL_Country..Caption = "Country"
COL_VehicleTyle..Caption = "Vehicle"
COL_OrderDate_Year..Caption = "Year"
COL_OrderDate_Quarter..Caption = "Quarter"
COL_OrderDate_Month..Caption = "Month"
New in version 19

Adding a column or row title

By default, the rows or columns of a Pivot Table control have no title. You have the ability to add one with ..Caption used on the header name.
For example:
  • Pivot table not displaying a title:
  • Pivot table with a title:
The following code is used:
// Initialize PVT_Stats
COL_Continent..Caption = "Continent"
COL_Country..Caption = "Country"
COL_VehicleTyle..Caption = "Vehicle"
COL_OrderDate_Year..Caption = "Year"
COL_OrderDate_Quarter..Caption = "Quarter"
COL_OrderDate_Month..Caption = "Month"

Adding a column or row title

By default, the rows or columns of a Pivot Table control have no title. You have the ability to add one with ..Caption used on the header name.
For example:
  • Pivot table not displaying a title:
  • Pivot table with a title:
The following code is used:
// Initialize PVT_Stats
COL_Continent..Caption = "Continent"
COL_Country..Caption = "Country"
COL_VehicleTyle..Caption = "Vehicle"
COL_OrderDate_Year..Caption = "Year"
COL_OrderDate_Quarter..Caption = "Quarter"
COL_OrderDate_Month..Caption = "Month"
Versions 19 and later

Making a value invisible

By default, all the values of a pivot table are displayed. In some cases, it may be interesting to calculate the values but not to display them. The values exist in the Pivot Table control and they can be used to perform a calculation or to fill a chart for example, ...
To make a value invisible, all you have to do is use ..Visible.
Example: A pivot table displays in each cell the turnover and the quantity sold. A chart is built from the quantity sold and this quantity must not be displayed in the Pivot Table control. To do so, use the following code line in the initialization code of the Pivot Table control:
VAL_Qty..Visible = False
New in version 19

Making a value invisible

By default, all the values of a pivot table are displayed. In some cases, it may be interesting to calculate the values but not to display them. The values exist in the Pivot Table control and they can be used to perform a calculation or to fill a chart for example, ...
To make a value invisible, all you have to do is use ..Visible.
Example: A pivot table displays in each cell the turnover and the quantity sold. A chart is built from the quantity sold and this quantity must not be displayed in the Pivot Table control. To do so, use the following code line in the initialization code of the Pivot Table control:
VAL_Qty..Visible = False

Making a value invisible

By default, all the values of a pivot table are displayed. In some cases, it may be interesting to calculate the values but not to display them. The values exist in the Pivot Table control and they can be used to perform a calculation or to fill a chart for example, ...
To make a value invisible, all you have to do is use ..Visible.
Example: A pivot table displays in each cell the turnover and the quantity sold. A chart is built from the quantity sold and this quantity must not be displayed in the Pivot Table control. To do so, use the following code line in the initialization code of the Pivot Table control:
VAL_Qty..Visible = False
Versions 19 and later

Finding out and modifying the mask used to display values

To find out and modify the type displayed for a value of a Pivot Table control, use ..InputType. You can use the following syntax:
{{"Value Name"}}..InputType = typInputDuration
or:
ValueName..InputType = typInputDuration
New in version 19

Finding out and modifying the mask used to display values

To find out and modify the type displayed for a value of a Pivot Table control, use ..InputType. You can use the following syntax:
{{"Value Name"}}..InputType = typInputDuration
or:
ValueName..InputType = typInputDuration

Finding out and modifying the mask used to display values

To find out and modify the type displayed for a value of a Pivot Table control, use ..InputType. You can use the following syntax:
{{"Value Name"}}..InputType = typInputDuration
or:
ValueName..InputType = typInputDuration
Versions 19 and later

Modifying the axes displayed

You have the ability to modify the axes displayed or to reverse the rows and columns with PVTAxisXY.
Example:
// Modifies the rows and columns displayed
PVTAxisXY(PVT_Stats, "COL_Year" + CR + "COL_Quarter", "COL_VehicleType" + CR + "COL_Model")
New in version 19

Modifying the axes displayed

You have the ability to modify the axes displayed or to reverse the rows and columns with PVTAxisXY.
Example:
// Modifies the rows and columns displayed
PVTAxisXY(PVT_Stats, "COL_Year" + CR + "COL_Quarter", "COL_VehicleType" + CR + "COL_Model")

Modifying the axes displayed

You have the ability to modify the axes displayed or to reverse the rows and columns with PVTAxisXY.
Example:
// Modifies the rows and columns displayed
PVTAxisXY(PVT_Stats, "COL_Year" + CR + "COL_Quarter", "COL_VehicleType" + CR + "COL_Model")

Modifying the data source

You also have the ability to modify the data source of a Pivot Table control via ..BrowsedFile.
Example:
// Modifies the rows and columns displayed
PVT_Stats..BrowsedFile = Stat2015
Caution:
  • If the Pivot Table control is based on a data file, the new source data file must have the same structure as the file used when creating the control.
  • Versions 20 and later
    If the Pivot Table control is based on an array of structures:
    • the new source array of structures must have the same structure as the variable used when creating the control.
    • the name of the new structure must be preceded by ":". For example:
      PVT_Stats..BrowsedFile = ":MyNewStructure"
    New in version 20
    If the Pivot Table control is based on an array of structures:
    • the new source array of structures must have the same structure as the variable used when creating the control.
    • the name of the new structure must be preceded by ":". For example:
      PVT_Stats..BrowsedFile = ":MyNewStructure"
    If the Pivot Table control is based on an array of structures:
    • the new source array of structures must have the same structure as the variable used when creating the control.
    • the name of the new structure must be preceded by ":". For example:
      PVT_Stats..BrowsedFile = ":MyNewStructure"

Progress of calculation

  • A progress bar is displayed during the calculation of the Pivot Table control.
  • Versions 20 and later
    The user has the ability to cancel the calculation via a "Cancel" button.
    To find out whether the calculation was entirely performed, use the ErrorOccurred variable.
    Example:
    PROCÉDURE Load_PVT()

    PVTCalculateAll(PVT_Statistics)
    IF ErrorOccurred = True THEN
    SWITCH Dialog("Do you want to cancel the current process?")
    // Cancel
    CASE 1
    Close()
    // Continue
    CASE 0
    Load_PVT()
    END
    END
    New in version 20
    The user has the ability to cancel the calculation via a "Cancel" button.
    To find out whether the calculation was entirely performed, use the ErrorOccurred variable.
    Example:
    PROCÉDURE Load_PVT()

    PVTCalculateAll(PVT_Statistics)
    IF ErrorOccurred = True THEN
    SWITCH Dialog("Do you want to cancel the current process?")
    // Cancel
    CASE 1
    Close()
    // Continue
    CASE 0
    Load_PVT()
    END
    END
    The user has the ability to cancel the calculation via a "Cancel" button.
    To find out whether the calculation was entirely performed, use the ErrorOccurred variable.
    Example:
    PROCÉDURE Load_PVT()

    PVTCalculateAll(PVT_Statistics)
    IF ErrorOccurred = True THEN
    SWITCH Dialog("Do you want to cancel the current process?")
    // Cancel
    CASE 1
    Close()
    // Continue
    CASE 0
    Load_PVT()
    END
    END

Properties specific to the management of Pivot Table controls

The following properties are used to manage the Pivot Table controls:
Versions 18 and later
Cumulated
New in version 18
Cumulated
Cumulated
..Cumulated is used to find out whether the value of a row or column found in a Pivot Table control corresponds to a total (total at the end of ra ow or at the end of a column).
Versions 18 and later
DisplayOrphan
New in version 18
DisplayOrphan
DisplayOrphan
..DisplayOrphan is used to
  • Find out whether a row or a column found in a Pivot Table control is displayed when it has no parent
  • Modify the display mode of a row or column in a Pivot Table control when it has no parent
Versions 18 and later
FilterProcedure
New in version 18
FilterProcedure
FilterProcedure
..FilterProcedure is used to find out and modify the procedure that will be called to filter on a row or column header when calculating a pivot table.
Versions 18 and later
ProgressBar
New in version 18
ProgressBar
ProgressBar
..ProgressBar allows you to find out and modify the Progress Bar control used when calculating a pivot table (PVTCalculateAll and PVTCalculateUpdate).
To find out the entire list of WLanguage properties that can be used with a Pivot Table control, see Properties associated with the Pivot Table control.
Minimum required version
  • Version 18
Comments
Click [Add] to post a comment