PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of pvtPosition variables
  • Operating mode
  • Case of pivot tables with filter
  • Modifying the characteristics of a cell
  • Functions that handle the pvtPosition variables
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
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: See Declaring a variable for more details.
Example
// Declaration
x is pvtPosition of PVT_Sales

// Specify the values of the cell headers
x.Year = "2009"
x.Quarter = "2009Q1"
x.Month = "200901"
x.Product..Cumulated = True

// Display the total of sales for all the products in January 2009
STC_Result = PVT_Sales.Value1[x]
Remarks

Properties specific to the description of pvtPosition variables

The following properties can be used to handle a pvtPosition variable:
Property nameType usedEffect
OutBoolean
  • True if the specified position is outside the pivot table.
  • False if the position is valid.
This property is available in read-only.
This property is used to find out whether the position specified by PVTInfoXY exists.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Operating mode

To handle a pvtPosition variable, you must:
  • specify the values of headers for the requested cell. For example:
    MyPosition is pvtPosition of PVT_Statistics
    // Indicate the headers
    MyPosition..COL_Continent = "Europe"
    MyPosition..COL_OrderDate_Year = "2012"
  • access a value of the pivot table via the following syntax:
    <Name of pivot table>.<Value name>[<pvtPosition variable>]

    For example:
    // Retrieves the "VAL_Qty" value
    nQuantity = PVT_Statistics.VAL_Qty[MyPosition]
Notes:
  • 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.
  • ..Out is used to find out whether the position specified by PVTInfoXY exists.

Case of pivot tables with filter

The pvtPosition variables handle the data found in the entire pivot table: even the data that is not displayed is taken into account. When using filters (PVTFilter), this filter must be declared in the pvtPosition variable.
Example:
MyPosition is pvtPosition of PVT_Statistics

// Indicates the filter
MyPosition..COL_FILTER_Product = COMBO_Product

// Indicate the headers
MyPosition..COL_Continent = "Europe"
MyPosition..COL_OrderDate_Year = "2012"

// Retrieves the "VAL_Qty" value
nQuantity = PVT_Statistics.VAL_Qty[MyPosition]

Modifying the characteristics of a cell

To highlight a cell when it is displayed (maximum value, minimum value, ...), you have the ability to use a pvtPosition variable.
Example:
MyPosition is pvtPosition of PVT_Statistics

// Indicate the headers
MyPosition..COL_Continent = "Europe"
MyPosition..COL_OrderDate_Year = "2012"

// Modifies the background color of the "VAL_Qty" value
VAL_Qty[MyPosition]..BrushColor = LightRed

Functions that handle the pvtPosition variables

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