|
|
|
|
- Properties specific to pvtPosition variables
- Operating mode
- Case of pivot tables with filter
- Modifying the characteristics of a cell
- Functions that use pvtPosition variables
pvtPosition (Type of variable) In french: tcdPosition
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). Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable. // Declaration x is pvtPosition of PVT_Sales // Specify the values of the cell headers x.Year = "2020" x.Quarter = "2020Q1" x.Month = "202001" x.Product.Cumulated = True // Display the total of sales for all the products in January 2020 STC_Result = PVT_Sales.Value1[x] Remarks Properties specific to pvtPosition variables The following properties can be used to handle pvtPosition variables: | | | Property name | Type used | Effect |
---|
Out | Boolean | - 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. |
Operating mode To handle a pvtPosition variable, you must: - specify the values of headers for the desired 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]
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 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].BackgroundColor = LightRed
Functions that use pvtPosition variables | | PVTInfoXY | Returns the values of headers corresponding to a position in a Pivot Table control in pixels. | PVTListPositionHeader | Returns all values associated with a row or column header in a Pivot Table control. | PVTSelect | Allows you to find out the position of selected cells and to select cells in a Pivot Table control. |
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|