Sum subitems

2 posts, 0 answers
  1. Zbigniew Kozłowski
    Zbigniew Kozłowski avatar
    60 posts
    Member since:
    Apr 2010

    Posted 21 Aug 2010 Link to this post

    Hi,
    i got a question how can i achive to sum price of all invoice elements? i mean i tried something like that:

    var query = from i in scope.Extent<Invoice>()
                            select new
                            {
                                Id = i.Id,
                                Code = i.Code,
                                ContactDescription = i.Contact.Description,
                                Price = (from ii in i.Invoiceitems select new { Price = ii.Price * ii.Quantity }).Sum(ii => ii.Price),
                                DocumentDate = i.DocumentDate
                            };

    but it throws error with sum on server side

    tried also something like this:
    var query = from i in scope.Extent<Invoice>()
                            select new
                            {
                                Id = i.Id,
                                Code = i.Code,
                                ContactDescription = i.Contact.Description,
                                Prices = i.Invoiceitems.Sum(p=> (p.Quantity*p.Price)),
                                DocumentDate = i.DocumentDate
                            };

    is it possible to make such sum?
  2. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 24 Aug 2010 Link to this post

    Hi Zbigniew Kozłowski,

    Thank you for writing.
    Unfortunately OpenAccess does not have support for sub-selects in LINQ queries yet.
    And this is why you are getting errors when you try to execute such a query.
    We are working to improve our sub-select support and our LINQ support in general but unfortunately I cannot give you a time frame at the moment when such queries will be supported by OpenAccess.

    Sincerely yours,
    Jordan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top