How do I reference specific columns in the PivotTable?...

R

RayTheOtherRay

Based on the following code...

var pt = document.getElementById('My_PivotTable');
var pd = pt.ActiveData;
var ra = pd.RowAxis;
alert(ra.Fields.Count); // displays 1
var fldmakebuy = ra.Fields(0);
alert(fldmakebuy.Name); // displays MakeBuy

I have a pivot table (pt) which has one column (fldmakebuy) on the
left. I have found that if I click in a cell in the first row of data
below the subsequent column headings, that I can sort the row in
ascending or descending order based on that column by clicking on the
"A->Z" or "Z->A" buttons on the tool bar. In addition, I can perform a
"Top 10" filtration based on that Column, as well. I'd like to perform
this programatically. I cannot seem to get a handle on the object I
need.

The columns to the right of the MakeBuy column represent Measures in
the cube that is feeding the PivotTable. The particular column in
which I am interested is three columns over from the MakeBuy column. I
have the .chm file of the OCW11 object model as well as a large .png
file that graphically illustrates the heirarchy of the model. If I can
define the field fldoverunder, then the following code should work...

fldoverunder.FilterFunction = 3; // constant plFilterFunctionTopCount
fldoverunder.FilterFunctionValue = 10;

I need to find the object trail to get from...

var pt = document.getElementById('My_PivotTable');
var pd = pt.ActiveData;
var ra = pd.RowAxis;

....to...

fldoverunder.FilterFunction = 3; // constant plFilterFunctionTopCount
fldoverunder.FilterFunctionValue = 10;

Any direction or example is greatly appreciated!
Thanks!
Ray <><
 
R

RayTheOtherRay

Okay, I finally found it for myself. :cool:
For anyone searching the archives for the same thing, I'll post my
findings. Using a combination of the SelectionChange() event and the
Selection and SelectionType properties...

<script language='javascript'
for=MyPivotChartNameHere
event=SelectionChange()>
pc=getElemementById('MyPivotChartNameHere');
// show a constant indicating what type of chart object the user
selected
alert(pc.SelectionType);
// show the caption of that object if there is one.
alert(pc.Selection.Caption);
</script>

I can investigate the values for the part of the chart I'm selecting.
For one case in which I'm interested, I want to jump to a different
page if the user selects one of a specific list of category captions
below the plot area. By comparing the Caption value of the item, I can
determine to which other page I'd like to navigate.

Further use of this will be with a pivot table so that I may choose the
column by which I would like to sort, or on which I would like to place
a "Top 10" property.

Hope this helps!
Ray <><
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top