Hi,
In the context of this post, I'm trying to extend Infragistics.Olap.Data.Xmla.SqlAnalysisServices2008.Member class to add some metadata that I will need to navigate to other datasource.
Based on this post from Atanas Dyulgerov about creating a custom provider, the override method for LoadMembersAsync(ICube cube, IFilterMember filterMember) has the following implementation:
public override void LoadMembersAsync(ICube cube, IFilterMember filterMember)
{
AdomdProviderClient client = AdomdClientHelper.GetAdomdProviderClient(GetApplicationHostUri());
client.LoadFilterMemberMembersCompleted += (s, args) =>
if (args.Error == null && !args.Cancelled)
Member prentMember = filterMember.Member as Member;
ClearMemberChildren(prentMember);
foreach (AdomdMember member in args.Result)
DimensionMember currentMember =
new DimensionMember(
member.Name,
member.UniqueName,
member.Caption,
member.ParentUniqueName,
member.LevelUniqueName,
(int)member.LevelNumber,
filterMember.Member.ParentLevel.ParentHierarchy.Levels[(int)member.LevelNumber],
(int)member.ChildrenCardinality,
false,
false);
currentMember.DrilldownMetadata = member.DrilldownMetadata;
AddMember(prentMember, currentMember);
}
this.OnLoadMembersCompleted(new AsyncCompletedEventArgs(args.Error, args.Cancelled, filterMember));
};
client.LoadFilterMemberMembersAsync(this.ConnectionString, cube.Name, filterMember.Member.UniqueName, filterMember.Member.ParentLevel.Depth + 1);
In this code, the DimensionMember class inherits from Infragistics.Olap.Data.Xmla.SqlAnalysisServices2008.Member, adding the metadata property (xml data).
This works fine for rendering the level members, but when I try to access the members of the generated tuples, I can not obtain a valid DimensionMember instance (for example, in the CellClicked Event).
As suggested in the post above, the corresponding tuple is obtained through the following code:
int rowIndex = myPivot.DataRows.IndexOf(cell.DataRow);
ITuple rowTuple = myPivot.DataSource.Result.RowAxis.Tuples[rowIndex];
But the following line returns a Infragistics.Olap.Data.Xmla.SqlAnalysisServices2008.Member instance (which implements IMember interface), and I can not cast it to a DimensionMember instance (returns null), maybe because the members are not created with the same references returned by the custom provider:
var dimensionMember = rowTuple.Members[0];
So, my question is if it is possible to add this custom metadata in the custom provider, and access it through the result tuples?
Thanks in advance.
Rui.
Hi PPilev,
Thank you for your response. This solution works fine.
Best regards.
Hello Rui,
You are right when you are saying that these instances of the members differ with these created initially. You can look at AdomdCommand.GenerateAxis(AxisData) static method where the tuples are populated with their members. You’ll find that there are created new members with the data passed through AxisData parameter. That’s the place where you have to create your custom member instances if you expect to find them in the tuples collection later. I see that there are some backwards using it in this way and we will consider to optimize the model in order to make it much easier for customization.
Thank you for your time and feedback.
PPilev.