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

Aggregate Function / String Input

4 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Morgan
Top achievements
Rank 1
Iron
Morgan asked on 09 Mar 2012, 07:45 PM
So I am trying to get some Time values aggregated and I know what I have to get that value and do the math on that but I don't see the simple solution to getting the appropriate setup for the DataGridView with a custom aggregate function.  How would I take a value in this form: hh:mm:ss (ss are actually tracked) change it (ivalueconverter?) for the aggregation and then spit out a decimal format total?

I am completely buffaloed as to the method signature that is necessary to stop getting:

No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Mar 2012, 08:02 AM
Hello,

 Can you sum your values with a normal LINQ query? 

Kind regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Morgan
Top achievements
Rank 1
Iron
answered on 16 Mar 2012, 03:44 AM
So I had create a custom aggregator and do a summation of the minutes and hours of the field in question.  The field contains a date with the total hours & minutes (pay ammount) in date time format, easy for me to do date math for a aviation regulations.

The custom aggregator was hardcoded with type that the rows represent...
0
Pavel Pavlov
Telerik team
answered on 20 Mar 2012, 04:09 PM
Hi Morgan,

Since custom aggregates are a bit tricky I may offer an easier to implement and debug approach - Generic aggregate function. I am attaching a small sample of generic aggregate function with custom sum logic.

I believe with the proper Linq expression using the approach from this sample you can achieve what you are trying.

In case you have troubles adapting this to your scenario , just let me know ( pasting some c# of your objects as well).

Kind regards,
Pavel Pavlov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Morgan
Top achievements
Rank 1
Iron
answered on 12 Jun 2012, 02:16 AM
i got this figured out, I just went back into my db, converted all the values that were stored as time and converted them all to double type.  This has solved my problem.

Thanks.
Tags
GridView
Asked by
Morgan
Top achievements
Rank 1
Iron
Answers by
Vlad
Telerik team
Morgan
Top achievements
Rank 1
Iron
Pavel Pavlov
Telerik team
Share this question
or