This is a migrated thread and some comments may be shown as answers.

Record and GroupRecord obsolete

3 Answers 61 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johan Rabie
Top achievements
Rank 1
Johan Rabie asked on 30 Sep 2009, 01:59 PM
I get this compiler warning:
'Telerik.Windows.Data.Record' is obsolete: 'This class is obsolete and is not used anymore.'

I use Record and GroupRecord to drilldown on a chart.
Are these classes going to become obsolete in the future and if so what must I use instead.

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 30 Sep 2009, 02:26 PM
Hi Johan Rabie,

Unfortunately all Record classes (DataRecords, Record, etc) will become obsolete in a future release.

Could you share with how are using Record and GroupRecord so that we can provide you with an alternative solution which does not utilize those classes.

Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Johan Rabie
Top achievements
Rank 1
answered on 30 Sep 2009, 02:51 PM
I am building up a chart according to groupings and aggrigate functions.
Each grouping record is prepresented on the chart.
When you have multiple groupings, you can drilldown on the chart.
As you do so, it expands the grid accordingly.

See screenshot for details.
http://www.caperaven.co.za/screenshot.jpg

Some Code as for example:

 

private void ShowAggrigates(IList<Record> records, string functionName)

 

{

 

double[] values = new double[records.Count];

 

 

string[] labels = new string[records.Count];

 

 

for (var i = 0; i < records.Count; i++)

 

{

 

GroupRecord record = (GroupRecord) records[i];

 

 

AggregateResult result = record.GetAggregateResult(functionName);

 

values[i] =

Convert.ToDouble(result.Value, CultureInfo.CurrentCulture);

 

 

if (record.Header.GetType() == typeof (string))

 

{

labels[i] = (

string) record.Header;

 

}

 

else

 

{

labels[i] =

Convert.ToString(record.Header, CultureInfo.CurrentCulture);

 

}

}

Chart.DefaultView.ChartArea.DataSeries.Clear();

Chart.AddSeries(functionName,

new BarSeriesDefinition(), values, labels);

 

}

0
Milan
Telerik team
answered on 06 Oct 2009, 06:18 AM
Hi Johan Rabie,

You could try the following modified version of the ShowAggregates method:

private IEnumerable<AggregateFunction> GetFunctionByName(string functionName)  
{  
    var functions =  
        from descriptor in this.playersGrid.GroupDescriptors  
        from function in descriptor.AggregateFunctions  
        where function.FunctionName == functionName  
        select function;  
 
    return functions;  
}  
 
private void ShowAggregates(string functionName)  
{  
    List<double> values = new List<double>();  
    List<string> labels = new List<string>();  
 
    foreach (AggregateFunctionsGroup group in this.playersGrid.Items)  
    {  
        var result = group.GetAggregateResults(this.GetFunctionByName(functionName)).First();  
        values.Add(Convert.ToDouble(result.Value, CultureInfo.CurrentCulture));  
        labels.Add(group.Key.ToString());  
    }  
 
    Chart.DefaultView.ChartArea.DataSeries.Clear();  
    Chart.AddSeries(functionName, new BarSeriesDefinition(), values.ToArray(), labels.ToArray());  

Here we use the Items property to retrieve all group items and extract their aggregate results.
Hope this helps.



All the best,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Johan Rabie
Top achievements
Rank 1
Answers by
Milan
Telerik team
Johan Rabie
Top achievements
Rank 1
Share this question
or