Populating .IncludeMembers with JavaScript...

R

RayTheOtherRay

I searched and found a helpful post allowing me to access PivotViews,
FieldSets, and Fields on the page that I'm trying to automate. But the
examples were presented in VB. I'm trying to do the same thing with
JavaScript.

I have an OLAP Cube Dimension named Calendar.
The levels in Calendar are Year, Month, WeekEnding and Date.

Below is my current code that is place below the "Wizard generated"
HTML code published from the Excel Spreadsheet.

<script language="javascript">

var pt = document.getElementById ('Book1_24147_PivotTable');
var pv = pt.ActiveView;
var fs = pv.FieldSets("[Calendar]");
var fld = fs.Fields("[Calendar].[Year]");

var inyr = new Array(4);
var x = 0
for (x = 0; x < 4; x++)
{
inyr[x] = "[Calendar].[All Dates].[" + (x + 2002) + "]";
}
alert(inyr[3]);

var exyr = new Array(27);
var y = 0
for (y = 0; y < 6; y++)
{
exyr[y] = "[Calendar].[All Dates].[" + (y + 1996) + "]";
}
alert(exyr[3]);

for (y = 6; y < 27; y++)
{
exyr[y] = "[Calendar].[All Dates].[" + (y + 2000) + "]";
}
alert(exyr[26]);

fld.IncludeMembers = inyr;
fld.ExcludeMembers = exyr;
fs.AllIncludeExclude = plAllExclude;

</script>

Using the Alert statements, I can see that the arrays are being filled.
When I add the .IncludeMembers, .ExcludeMembers, and
..AllIncludeExclude statements the refreshed page status is "Done" but
no filtering takes place.

Is there something obvious that I'm overlooking?

Thanks!
Ray <><
 
R

RayTheOtherRay

In my searching of the Object Model, I've found how to enable the
constants and have added...

var ptcontstants = pt.Constants;

....after the establishement of the pt var. Also, the setting of the
..AllIncludeExclude property for the FieldSet has become...

fs.AllIncludeExclude = ptconstants.plAllExclude;

The current state of things is that, now, all data is excluded...not
just the members that go unmentioned in the .IncludeMembers and
..ExcludeMembers properties. I think that I'm either not properly
referring to the exact names of the members, or there is another nuance
to this whole process that I'm missing.

Still in search of...
Ray <><
 
R

RayTheOtherRay

One more time...the proper name for the properties I am trying to set
are...

..IncludedMembers and .ExcludedMembers

....not...

..IncludeMembers and .ExcludeMembers

....as I was typing them. As I found in the previously searched post,
it is also very important to know the exact values to place in the
Array that fills these two properties. This has turned into a big DOH!
for me, but I hope that my mistakes will help someone else!

Thanks!
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