Hello!
Is there a way to get all members of a single dimension?
I have an application were we want to restore saved pivotviews and I have the issue that I cannot check if a given member exists because I don't find any way to get the members of any dimension.
Additionally it would be great to have a chance to get the names of certain members. For example if we filter a dimension for a single value, I can only obtain the ID of the filtered object, but not its name.
BR
Daniel
Hello Daniel,
Depending on the data source that you're using (ig.OlapFlatDataSource or ig.OlapXmlaDataSource) for your igPivotGrid you would use its API. For example if you're using ig.OlapFlatDataSource you can get the member of the column axis using ig.OlapFlatDataSource.columnAxis method and for row axis ig.OlapFlatDataSource.rowAxis method.
Here is an example:
var colAxis = $("#pivotGrid").igPivotGrid("option", "dataSource").columnAxis();
Each member has an unique name which you can obtain with the ig.Measure.uniqueName() method.
Example:
$("#pivotGrid").igPivotGrid("option", "dataSource").columnAxis()[0].uniqueName();
To get the filtered members use the ig.OlapFlatDataSource.getFilterMemberNames() method like this:
$("#pivotGrid").igPivotGrid("option", "dataSource").getFilterMemberNames("[Product].[Product]");
I'm also attaching a sample which demonstrates how you can programmatically set dimensions when initializing the igPivotGrid.
Hope this helps,Martin PavlovInfragistics, Inc.
Hello Martin,
Thank you for your reply!
The method getFilterMemberNames comes close to what we need, but it's not perfect for what we're trying to do because it returns only the selected filters, and an empty array if "all" is selected - But we need a function that returns ALL membernames when no filter is set.
The scenario is that we want to save the state of a pivot view, i.e. members with location, filters and expanded members.
Now if we expand a member (for example the second element of the only dimension on the rowaxis), we get the axis, tupleindex and memberindex in the event "igpivotgridtuplememberexpanding". Now if we want to restore the view we would simply use the method "expandtuplemember" to expand the same axis/tupleindex/memberindex.
The problem is that these indexes may change due to filtering (for example: a filter for the member is set, the first 2 elements aren't selected and the element that has had the index '5' beforehand suddenly has an index of '3').
This is why we'd like a possibility to obtain the filtermembername of the expanded element and save this instead of the index - so we could determine the actual index before restoring.
Unfortunately we didn't find a method we could use for this, even though getfiltermembernames() comes close (it's just that we need a way to get all members if nothing is filtered).
You can try the ig.OlapFlatDataSource.getMembersOfMember API (I'll check why this API is not documented).
Here is an example code:
var dataSource = $("#pivotGrid").igPivotGrid("option", "dataSource");
dataSource.getMembersOfMember("[Seller].[Seller].[AllSellers].&[All Sellers]").done(function(members) {
var _members = members.__inner, membersNames = [];
for (var i = 0; i < _members.length; i++) {
membersNames.push(_members[i].uniqueName());
}
});
Best regards,Martin PavlovInfragistics, Inc.
I logged an internal issue with Development ID 203841 about the getMembersOfMember API not presented in the API docs.
I also created a case on your behalf with number CAS-159106-T6R9V6, so that you can be notified when there is a resolution for the issue.
You can find your active cases under Account - Support Activity in our website. Select your ticket and go to Development Issues tab to view the status of related development issues.
Thank you very much, I think this could be exactly what we're looking for!