I need a code example of accessing summary results in code behind which got grouped by. Basically I have a XamTabcontrol with two tabs and first one have a Xamdatagrid with grouping and summary results, based upon this values in the code behind for the second tab selectionchanged event I want to access all the summary values and groupby column and values grouped by for the piechart I have it in the second tab. I would really appreciate any code examples for this scenario. Thanks.
Hi, I figured it out by googling and looking around code samples....here is the code....
private void xamTabControlDrillDown_SelectionChanged(object sender,SelectionChangedEventArgs e)
{
if (e.AddedItems.Count > 0)
if (this.tabItemGraph != null && this.tabItemGraph.IsSelected &&
this.XamDataGridDrillDown.Records.DataPresenter.GroupByArea.GroupedFieldLabels.Count > 0)
IList<Data> list = new List<Data>();
GroupByRecordCollection groupByRecords = this.XamDataGridDrillDown.Records as GroupByRecordCollection;
foreach (GroupByRecord gbr in groupByRecords)
///int count = CountDataRecords(gbr);
foreach (Record child in gbr.ViewableChildRecords)
SummaryRecord summaryRecord = child as SummaryRecord;
if (null != summaryRecord && summaryRecord.SummaryResults != null)
IEnumerable<SummaryResult> sr = summaryRecord.SummaryResults;
foreach (SummaryResult sResult in sr)
Data data = new Data() { Type = (String)gbr.Value,
Count = (Decimal)sResult.Value,
Tooltip = (String)gbr.Value + " " + sResult.Value.ToString() };
list.Add(data);
}
xamChartDrillDown.RefreshEnabled = false;
xamChartDrillDown.Caption.Text = "Transactions Grouped By "+ this.XamDataGridDrillDown.Records.DataPresenter.GroupByArea.GroupedFieldLabels[0].Field.Label.ToString();
xamChartDrillDown.Series[0].DataSource = list;
xamChartDrillDown.Series[0].DataMapping = "Value=Count;Label=Type;ToolTip=Tooltip";
xamChartDrillDown.RefreshEnabled = true;
xamChartDrillDown.Refresh();
Hi Alex, I did see that example but what I need is for Heirarchical XDG, thats where I am really looking for an example. If you look at my screen shot the summary results I need to get hold of for the Heirarchical level too. Hope you can provide a code snippet or point to an good example for that!.
Thanks
Ganesh
Hello,
You can see how to access summary results in the XamFeatureBrowser, which is installed with our products. The specific sample you can find under XamDataGrid - Row Summaries - Accessing Summary Result in Code.
As far as the GroupByRecords are concerned, you can find them in the Records collection of the XDG and check for the GroupByRecord.Description property.