Hi,
I navigate a new page to load the cubes. When I navigate to new page I connect to my cube database but it not seems to load the Cubes. So I have add a listener after connected.
this.PivotGrid.DataSource.LoadSchemaAsync(); this.PivotGrid.DataSource.LoadCubesCompleted += new EventHandler<LoadCubesCompletedEventArgs>(DataSource_LoadCubesCompleted);
private void DataSource_LoadCubesCompleted(object sender, LoadCubesCompletedEventArgs e) { if (this.PivotGrid.DataSource.Cubes.Count > 0) {
this.dataProvider.LoadDimensionsAsync("CubeName");
this.PivotGrid.DataSource.LoadDimensionsCompleted +=
new EventHandler<AsyncCompletedEventArgs>(DataSource_LoadDimensionsCompleted);
}
After loading all cubes I call the Dimensions Load. And Fetch the Xml data to pivot grid. But DataSource_LoadDimensionsCompleted is fired more than once. So the Fill method add only row to grid. And fire the Fill () method secondly. Second time it add row again and failes.
public void DataSource_LoadDimensionsCompleted(object sender, AsyncCompletedEventArgs e)
{
XMLSerializedView.Fill();
I call after the Fill() method that:
this.PivotGrid.DataSource.LoadDimensionsCompleted -= new EventHandler(DataSource_LoadDimensionsCompleted);
But it does not solve my problem.How can I control the cube and dimensions loading ?
Hello,
If your point is to have specific cube selected then you need:
1. Get subscribed for LoadCubesCompleted and Initialized events first.
2. Call LoadSchemaAsync() method.
3. When LoadCubesCompleted is fired look at the Cubes collection for the cube you are interested in.
4. Set dataSource.Cube = cube;
5. Wait for Initialized event. At this point you have all dimensions, hierarchies and their levels loaded (the metadata tree). You can access this data through dataSource.Metadata property and can continue with adding an items to Rows, Columns and ect.
Plamen.
I follow these steps firstly but it continue to call LoadDimensionsAsync. So I add
this.pivotGrid.DataSource.LoadDimensionsCompleted -= new EventHandler<AsyncCompletedEventArgs>(DataSource_LoadDimensionsCompleted);
in the LoadDimensionsCompleted method.
The problem seems to solve the problem. But Now, cube dimension loaded twice. DataSource.Cube.Dimensions.Count and dim.Hierarchies.Count are duplicated.