Hi, I'm using a FlatDataSource in a xampivotgrid and I'm trying to implement a use case where the user can select a cell and click a button to initiate some business logic in my application. My business logic will require accessing all the underlying objects that make up the sum in the ActiveCell. It could be just 1 object or many of course, depending on the cell and the hierarchy the user has created.
Hi
You still can use the code above, but you should do some additional filtering and processing when you retrieve the data. I mean that when you loop indexes you should check for state and store its data.
FlatDataSource flatDataSource = (FlatDataSource)pivotGrid.DataSource; ICell cell = pivotGrid.DataSource.Result.Cells[0, 0]; List<int> itemsIndexes = flatDataSource.GetCellItemsIndexes(cell); Dictionary<string, int> population = new Dictionary<string, int>(); population.Add("KY", 0); foreach (int itemIndex in itemsIndexes) { MyRowModel dataItem = flatDataSource.GetRecord(itemIndex) as MyRowModel; if (dataItem.State == "KY") { population["KY"] = population["KY"] + 9; } }
Regards
Todor
Hello,
Can I get underlying data from cell for next level without expanding current member?
For example, there is a geography dimension with three hierarchy, country / state / county. Now the active cell is the population of country, and I want to get the population of each state without expanding the member of country, can I do that?
Best regards.
312
In v11.1 there are two methods exposed by FlatDataSource you can use. Here is a sample:
List<int> itemsIndexes = flatDataSource.GetCellItemsIndexes(ICell);
foreach (int itemIndex in itemsIndexes)
{
object dataItem = flatDataSource.GetRecord(itemIndex);
}
I hope this will cover just what you need.
Also if you are interested in please note that in v11.1 you can implement and apply your custom aggregators as well.
PPilev.