The code below is from a button that I've been using to investigate how to get the value back from a specific property (IncludedMembers) of a PivotTable object from the Microsoft Office Web Components.
<input type="button"
value="In Search of..."
name="InSearchOf"
onClick="debugger;
var pt=document.getElementById('PivotTable1');
var pv=pt.ActiveView;
var pa=pv.FilterAxis;
var fstcns=pa.FieldSets('[TCNs]');
var fldcontract=fstcns.Fields('[TCNs].[Cntrct]');
var aincl = new Array(1);
aincl[0] = 'A00115-a';
alert(aincl[0]);
alert(aincl.length);
fldcontract.IncludedMembers = aincl;
alert(fstcns.AllIncludeExclude);
alert(fstcns.FilterCaption);
return true">
The variables break down (mostly for my sanity and readability) the object...
pt.ActiveView.FilterAxis.FieldSets('[TCNs]').Fields('[TCNs].[Cntrct]')
In order to programmatically filter the pivot table on the page, you must supply the filtering value ('A00115-a') to the IncludedMembers property of the field (fldcontract). In addition, you have to set the AllIncludeExclude property of the fieldset (fstcns) to 2 (meaning ignore all records whose values were not listed in the IncludedMembers or ExcludedMembers properties). I have been able to make this happen programmatically.
I have also interactively, using features of the PivotTable object, changed the contract value to the one I desire, and have then looked at the state of things in the debugger.
The problem is that I cannot retrieve the state of the IncludedMembers property from the object. When I try to make reference to it, the javascript error says that it is undefined.
By its definition in the Microsoft Office Web Components documentation, it states that it is a variant or variant array of pivot members. A post from another forum suggested that the variants are VBScript values and must be converted from the variants back to an array before they can be read. Using this suggestion I tried...
var aretrieve = new Array(1)
aretrieve = VBArray(fldcontract.IncludedMembers).toarray;
The VBArray line yields "Expecting a VBArray" when you don't specify a field value by which to filter. When you do specify a field value, that statement runs fine and produces the appropriate filtering results on the page. However, when I try to alert the value of aretrieve...
alert(aretrieve[0]);
alert(aretrieve.length);
...I get "0 is null or is not an object" or "length is null or is not an object"
I want to retrieve the value of the IncludedMembers property so that I can place the value in a cookie that will cause another associated page to be filtered as the current one.
I'm new to javascript. Are there properties that you are aware of that might aid me in determining the type of the IncludedMembers property values?
Thanks!
Ray <><
"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh
<input type="button"
value="In Search of..."
name="InSearchOf"
onClick="debugger;
var pt=document.getElementById('PivotTable1');
var pv=pt.ActiveView;
var pa=pv.FilterAxis;
var fstcns=pa.FieldSets('[TCNs]');
var fldcontract=fstcns.Fields('[TCNs].[Cntrct]');
var aincl = new Array(1);
aincl[0] = 'A00115-a';
alert(aincl[0]);
alert(aincl.length);
fldcontract.IncludedMembers = aincl;
alert(fstcns.AllIncludeExclude);
alert(fstcns.FilterCaption);
return true">
The variables break down (mostly for my sanity and readability) the object...
pt.ActiveView.FilterAxis.FieldSets('[TCNs]').Fields('[TCNs].[Cntrct]')
In order to programmatically filter the pivot table on the page, you must supply the filtering value ('A00115-a') to the IncludedMembers property of the field (fldcontract). In addition, you have to set the AllIncludeExclude property of the fieldset (fstcns) to 2 (meaning ignore all records whose values were not listed in the IncludedMembers or ExcludedMembers properties). I have been able to make this happen programmatically.
I have also interactively, using features of the PivotTable object, changed the contract value to the one I desire, and have then looked at the state of things in the debugger.
The problem is that I cannot retrieve the state of the IncludedMembers property from the object. When I try to make reference to it, the javascript error says that it is undefined.
By its definition in the Microsoft Office Web Components documentation, it states that it is a variant or variant array of pivot members. A post from another forum suggested that the variants are VBScript values and must be converted from the variants back to an array before they can be read. Using this suggestion I tried...
var aretrieve = new Array(1)
aretrieve = VBArray(fldcontract.IncludedMembers).toarray;
The VBArray line yields "Expecting a VBArray" when you don't specify a field value by which to filter. When you do specify a field value, that statement runs fine and produces the appropriate filtering results on the page. However, when I try to alert the value of aretrieve...
alert(aretrieve[0]);
alert(aretrieve.length);
...I get "0 is null or is not an object" or "length is null or is not an object"
I want to retrieve the value of the IncludedMembers property so that I can place the value in a cookie that will cause another associated page to be filtered as the current one.
I'm new to javascript. Are there properties that you are aware of that might aid me in determining the type of the IncludedMembers property values?
Thanks!
Ray <><
"I was going to change my shirt, but I changed my mind instead." - Winnie the Pooh