Aggregate to footer from boolean data

2 posts, 0 answers
  1. Harri
    Harri avatar
    10 posts
    Member since:
    Feb 2015

    Posted 23 Apr 2015 Link to this post


    I found many examples of custom aggregates and I'm able to do aggregate function with those helps for specific class with specific property which is used in my grid. But now I have few situations that I want to get count of checked (in class type boolean with value true) from that column. I would like to get it done in one function so I don't need to do several almost same kind code (only class and property changed).

    So how I have to change this function to get it work universally (without class 'DeliveriesForAccountsCls' and property name 'isChecked')?


    public class CheckedDeliveriesCount : AggregateFunction<DeliveriesForAccountsCls, double>
        public CheckedDeliveriesCount ()
            this.AggregationExpression = items => Summary(items);
        private double Summary(IEnumerable<DeliveriesForAccountsCls> source)
            var itemCount = source.Count();
            if (itemCount > 1)
                var values = source.Where(x => x.isChecked);
                var sum = values.Count();
                return sum;
            return 0;






  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 24 Apr 2015 Link to this post

    Hello Harri,

    As it turns out there is not a more universal way of defining generic AggregateFunctions. All the accessible information is the one available with the arguments of the function. 


    See What's Next in App Development. Register for TelerikNEXT.

Back to Top