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

Sum subitems

1 Answer 52 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Zbigniew Kozłowski
Top achievements
Rank 1
Zbigniew Kozłowski asked on 21 Aug 2010, 03:15 PM
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?

1 Answer, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 24 Aug 2010, 01:04 PM
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
Tags
LINQ (LINQ specific questions)
Asked by
Zbigniew Kozłowski
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Share this question
or