Accessing IncludedMembers in javaScript

C

Chris Magoun

Greetings,

I am using the PivotTable component from OWC10. I am writing client-side
javaScript to enumerate the included/excluded fiels in all of the pivot
table axes. However, I am having trouble accessing the includedMembers
property. Here is a code sample:


//------------Printing Routines------------

function CreateHeaderPageXML() {
//To create the header page XML, we need to enumerate through all of the
//fieldsets on the grid, and list their included members.

var sResult = "";

var axis = new Array();
axis[0] = m_av.rowAxis;
axis[1] = m_av.columnAxis;
axis[2] = m_av.filterAxis;

var axisName = new Array();
axisName[0] = "ROW";
axisName[1] = "COLUMN";
axisName[2] = "FILTER";

//enumerate axes
for(var iAxis = 0; iAxis < axis.length; iAxis++) {

//enumerate fieldset
for(var x = 0; x < axis[iAxis].fieldSets.count; x++) {
var fldSet = axis[iAxis].fieldSets(x);
sResult += fldSet.name + "\n";

//enumerate fields
for(var y = 0; y < fldSet.fields.count; y++) {
var fld = fldSet.fields(y);
sResult += "\t" + fld.name + "\n";
}

//HERE IS THE TROUBLE
if (fld.includedMembers != null) {
var aIncl = new Array();
aIncl = fldIncludedMembers;

for (var z = 0; z < aIncl.length; z ++) {
sResult += "\t\t" + aIncl[z].uniqueName + "\n";
}
}

}
}
alert(sResult);
}

Problem is, length is undefined, so is count. I also tried using a for...in
syntax with no luck. What the heck IS includedMembers?!?! I can write the
loop in VBScript using for...each with no trouble at all, but company
standard is javaScript. Can anyone give me some code samples of where they
accessed included/excludedMembers with javaScript?

Thank you,
Chris Magoun
 
D

Dan Ricker

The IncludedMembers is a Variant Array. The return value
is an array of PivotMembers

The JScript/JavaScript arrays are associative arrays and
VB/VBA/VBScript arrays need to be converted before they
can be used by JScript/JavaScript.

The below article has a section on converting arrays for
JScript/JavaScript.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnvid/html/msdn_vidateadd.asp

Title: Using VBScript and JScript on a Web Page
Section: Passing Arrays from VBScript to JScript

The sample function provided:

// Accesses a VBScript array within a JScript script
function getVBArray(){
var arrayObj;
var jsArray;
arrayObj = makeArrayVB();
jsArray = VBArray(arrayObj).toArray();
alert("VBScript array length = " + jsArray.length);
// Displays the contents of the array
for(i=1;i<=jsArray.length;i++){
alert(jsArray[i-1]);
}
}

Dan

-----Original Message-----
Greetings,

I am using the PivotTable component from OWC10. I am writing client-side
javaScript to enumerate the included/excluded fiels in all of the pivot
table axes. However, I am having trouble accessing the includedMembers
property. Here is a code sample:


//------------Printing Routines------------

function CreateHeaderPageXML() {
//To create the header page XML, we need to enumerate through all of the
//fieldsets on the grid, and list their included members.

var sResult = "";

var axis = new Array();
axis[0] = m_av.rowAxis;
axis[1] = m_av.columnAxis;
axis[2] = m_av.filterAxis;

var axisName = new Array();
axisName[0] = "ROW";
axisName[1] = "COLUMN";
axisName[2] = "FILTER";

//enumerate axes
for(var iAxis = 0; iAxis < axis.length; iAxis++) {

//enumerate fieldset
for(var x = 0; x < axis[iAxis].fieldSets.count; x++) {
var fldSet = axis[iAxis].fieldSets(x);
sResult += fldSet.name + "\n";

//enumerate fields
for(var y = 0; y < fldSet.fields.count; y++) {
var fld = fldSet.fields(y);
sResult += "\t" + fld.name + "\n";
}

//HERE IS THE TROUBLE
if (fld.includedMembers != null) {
var aIncl = new Array();
aIncl = fldIncludedMembers;

for (var z = 0; z < aIncl.length; z ++) {
sResult += "\t\t" + aIncl[z].uniqueName + "\n";
}
}

}
}
alert(sResult);
}

Problem is, length is undefined, so is count. I also tried using a for...in
syntax with no luck. What the heck IS
includedMembers?!?! I can write the
 
C

Chris Magoun

Thank you.


Dan Ricker said:
The IncludedMembers is a Variant Array. The return value
is an array of PivotMembers

The JScript/JavaScript arrays are associative arrays and
VB/VBA/VBScript arrays need to be converted before they
can be used by JScript/JavaScript.

The below article has a section on converting arrays for
JScript/JavaScript.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnvid/html/msdn_vidateadd.asp

Title: Using VBScript and JScript on a Web Page
Section: Passing Arrays from VBScript to JScript

The sample function provided:

// Accesses a VBScript array within a JScript script
function getVBArray(){
var arrayObj;
var jsArray;
arrayObj = makeArrayVB();
jsArray = VBArray(arrayObj).toArray();
alert("VBScript array length = " + jsArray.length);
// Displays the contents of the array
for(i=1;i<=jsArray.length;i++){
alert(jsArray[i-1]);
}
}

Dan

-----Original Message-----
Greetings,

I am using the PivotTable component from OWC10. I am writing client-side
javaScript to enumerate the included/excluded fiels in all of the pivot
table axes. However, I am having trouble accessing the includedMembers
property. Here is a code sample:


//------------Printing Routines------------

function CreateHeaderPageXML() {
//To create the header page XML, we need to enumerate through all of the
//fieldsets on the grid, and list their included members.

var sResult = "";

var axis = new Array();
axis[0] = m_av.rowAxis;
axis[1] = m_av.columnAxis;
axis[2] = m_av.filterAxis;

var axisName = new Array();
axisName[0] = "ROW";
axisName[1] = "COLUMN";
axisName[2] = "FILTER";

//enumerate axes
for(var iAxis = 0; iAxis < axis.length; iAxis++) {

//enumerate fieldset
for(var x = 0; x < axis[iAxis].fieldSets.count; x++) {
var fldSet = axis[iAxis].fieldSets(x);
sResult += fldSet.name + "\n";

//enumerate fields
for(var y = 0; y < fldSet.fields.count; y++) {
var fld = fldSet.fields(y);
sResult += "\t" + fld.name + "\n";
}

//HERE IS THE TROUBLE
if (fld.includedMembers != null) {
var aIncl = new Array();
aIncl = fldIncludedMembers;

for (var z = 0; z < aIncl.length; z ++) {
sResult += "\t\t" + aIncl[z].uniqueName + "\n";
}
}

}
}
alert(sResult);
}

Problem is, length is undefined, so is count. I also tried using a for...in
syntax with no luck. What the heck IS
includedMembers?!?! I can write the
loop in VBScript using for...each with no trouble at all, but company
standard is javaScript. Can anyone give me some code samples of where they
accessed included/excludedMembers with javaScript?

Thank you,
Chris Magoun


.
 

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