ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Pivot Table functions
  • Properties specific to pvtPosition variables
  • Operating mode
  • Case of pivot tables with filter
  • Modifying the characteristics of a cell
  • Functions that use pvtPosition variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The pvtPosition type is used to handle a cell of a Pivot Table control. This type of variable is mainly used to retrieve the value found in a cell or to modify the characteristics of the cell (the background color for example).
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Déclaration
x is pvtPosition of TCD_Ventes
// Spécifie les valeurs des entêtes de la cellule 
x.Année = "2020"
x.Trimestre = "2020T1"
x.Mois = "202001"
x.Produit.Cumul = True 
// Afficher le total des ventes de tous les produits en janvier 2020
LIB_Resultat = TCD_Ventes.Valeur1[x]
Properties

Properties specific to pvtPosition variables

The following properties can be used to define the characteristics of pvtPosition variables:
Property nameType usedEffect
OutBoolean
  • True if the specified position is outside the pivot table.
  • False if the position is valid.
This property is read-only.
This property is used to find out whether the position specified by PVTInfoXY exists.
Remarks

Operating mode

To handle a pvtPosition variable, you must:
  • specify the values of headers for the desired cell. For example:
    MaPosition is pvtPosition of TCD_Statistiques
    // Indique les entêtes
    MaPosition.COL_Continent = "Europe"
    MaPosition.COL_DateCommande_Année = "2012"
  • access a value of the pivot table via the following syntax:
    <Name of pivot table>.<Value name>[<pvtPosition variable>]

    For example:
    // Récupère la valeur "VAL_Qté"
    nQuantité = TCD_Statistiques.VAL_Qté[MaPosition]
Remarks:
  • If the position does not correspond to a displayed cell (because the cell is collapsed for example), you cannot retrieve the value of the cell or modify its color.
  • If the position does not correspond to a value that exists in the result (a product that was not sold this particular day for example), the returned value is 0.
  • If the position has a header name that does not exist in the pivot table, a WLanguage error is displayed.
  • A WLanguage error occurs if the position is outside the pivot table.
  • To get a cumulated total on a header, specify no header or set .Cumulated to True.
  • The .Out property can be used to determine if the position returned by PVTInfoXY exists.

Case of pivot tables with filter

Variables of type tcdPosition variables manipulate the entire crosstab array: non-displayed data are also taken into account. When using filters (PVTFilter), this filter must be declared in the pvtPosition variable.
Example:
MaPosition is pvtPosition of TCD_Statistiques
// Indique le filtre
MaPosition.COL_FILTRE_Produit = COMBO_Produit
// Indique les entêtes
MaPosition.COL_Continent = "Europe"
MaPosition.COL_DateCommande_Année = "2012"
// Récupère la valeur "VAL_Qté"
nQuantité = TCD_Statistiques.VAL_Qté[MaPosition]

Modifying the characteristics of a cell

To highlight a cell on the display (maximum, minimum value, etc.), you can use a variable of type tcdPosition variable..
Example:
MaPosition is pvtPosition of TCD_Statistiques

// Indique les entêtes
MaPosition.COL_Continent = "Europe"
MaPosition.COL_DateCommande_Année = "2012"

// Modifie la couleur de fond de la valeur "VAL_Qté"
VAL_Qté[MaPosition].CouleurFond = LightRed

Functions that use pvtPosition variables

PVTInfoXYReturns the values of headers corresponding to a position in a Pivot Table control in pixels.
PVTListPositionHeaderReturns all values associated with a row or column header in a Pivot Table control.
PVTSelectAllows you to find out the position of selected cells and to select cells in a Pivot Table control.
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help