How is the syntax in C # for this code?
<olap:XmlaDataSource x:Key="DataSource" ServerUri="">sampledata.infragistics.com/.../msmdpump.dll" Database="Adventure Works DW Standard Edition" Cube="Adventure Works" Filters="[Sales Territory].[Sales Territory Country]{[Sales Territory].[Sales Territory Country].&[United Kingdom]}" Columns="[Date].[Calendar]" Rows="[Geography].[City]" Measures="Reseller Sales Amount" />
Please Help me, thanks!
Hi
the code behind is like bellow:
XmlaDataSource xmlaDataSource = new XmlaDataSource();
xmlaDataSource.ServerUri = new Uri("http://sampledata.infragistics.com/olap/msmdpump.dll");
xmlaDataSource.Database = XmlaDataSource.GenerateInitialDatabase("Adventure Works DW 2008");
xmlaDataSource.Cube = DataSourceBase.GenerateInitialCube("Adventure Works");
xmlaDataSource.Columns = DataSourceBase.GenerateInitialItems("[Date].[Calendar]");
xmlaDataSource.Rows = DataSourceBase.GenerateInitialItems("[Geography].[City]");
xmlaDataSource.Filters = DataSourceBase.GenerateInitialItems("[Sales Territory].[Sales Territory Country]{[Sales Territory].[Sales Territory Country].&[United Kingdom]}");
xmlaDataSource.Measures = DataSourceBase.GenerateInitialItems("Reseller Sales Amount");
pivotGrid.DataSource = xmlaDataSource;
Regards
Todor
I'm specifically looking at Filters in this post. Is that the correct syntax? I'm using the following:
Filters
="[Product].[Sub Category Name]{[Product].[Sub Category Name].&[Segment 1]}"
I would expect the pivot data to be filtered by [Product].[Sub Category Name] whose value is "Segment 1". I get data back, but it's not filtered and the filter control on the xamPivotGrid is not changed either. And what if I also wanted "Segment 2". I don't see any examples as to the syntax on the XmlaDataSource reference page.
Thanks.
Hi,
Here are the XAML and code behind syntaxes:
[Code behind]xmlaDataSource.Filters = DataSourceBase.GenerateInitialItems("[Product].[Sub Category Name]{[Product].[Sub Category Name].&[Segment 1]}");[XAML]Filters="[Product].[Sub Category Name]{[Product].[Sub Category Name].&[Segment 1]}"
When the grid is loaded the Product hierarchy should appear in the filter area and in the hierarchy filter tree you have to see that just “Segment 1” member is checked.
Regards.
Plamen.
The stack might be helpful:
at Infragistics.Olap.Xmla.XmlaConnection.GetXmlaSoapWebClient[T]() at Infragistics.Olap.Xmla.XmlaDataProvider.LoadMembersAsyncImpl(ICube cube, Object userState, IDictionary`2 restrictions) at Infragistics.Olap.Xmla.XmlaDataProvider.LoadMembersAsync(ICube cube, IHierarchy hierarchy) at Infragistics.Olap.Xmla.XmlaDataSource.UpdateHierarchiesCollection(AreaItemsCollection hierarchiesCollection) at Infragistics.Olap.DataSourceBase.LoadInitialAreaItems() at Infragistics.Olap.DataSourceBase.CreateMetadataTree() at Infragistics.Olap.DataSourceBase.DataProviderLoadMeasureGroupDimensionsCompleted(Object sender, AsyncCompletedEventArgs e) at Infragistics.Olap.DataProviderBase.OnLoadMeasureGroupDimensionsCompleted(AsyncCompletedEventArgs args) at NCM.BIVizControls.AdomdDataProvider._client_LoadMeasureGroupDimensionsCompleted(Object sender, LoadMeasureGroupDimensionsCompletedEventArgs e) at NCM.BIVizControls.OLAPService.OLAPServiceClient.OnLoadMeasureGroupDimensionsCompleted(Object state)
If I step back a bit and set the Rows property on the xamPivotGrid to:
Rows="[Product].[Sub Category Name]"
This shows up fine and I see measures along with the ability to filter by "Segment 1", "Segment 2", "Online", etc. These filter attributes are showing up in the built in filtering mechanism. When I select Segment 1 the control refreshes with only the Segment 1 values. This is GREAT!
But I'd like to filter this before the user sees this control so I thought I could apply the value in curly braces {see above} ^^^ and this would work. It looks like the control is attempting to do this, but the AdomdDataProvider (that is part of the Infragistics samples) is blowing up on a Null Reference and I've been trying to track that down. So the data source is trying to do something different. If I have the syntax for the filtering incorrect, the the data source just ignores the filtering and I get ALL the values instead of just getting Segment 1.
For example if you look at the Adventure Works sample database:
The unique name of France is [Sales Territory].[Sales Territory].[Country].&[France] but that name is valid for [Sales Territory].[Sales Territory] hierarchy only.
[Sales Territory].[Sales Territory Country] hierarchy has France member as well:
but it has a different name - [Sales Territory].[Sales Territory Country].&[France]. So if you haven't another tool where you can check the member unique name you can check what member name pattern is used in the hierarchy you're trying to load.
Are you sure the unique name of Segment 1 is: [Product].[Sub Category Name].&[Segment 1]
But there is no other hierarchy level between Sub Category Name and Segment 1. "Segment 1" is a unique value under the "Sub Category Name" level, as long with "Segment 2" and "Online".
Hi,Now I see that you might pass a wrong member unique name, because the filter part is using the member’s unique name.
Columns="[Sales Territory].[Sales Territory]{[Sales Territory].[Sales Territory].[Country].&[France]}"
That name depends on the pattern that member name follow.