> q = context.TransactionDetails > .Where(t => t.Parcel.GoodsType.Description == "Rough") > .Where(x => x.TransactionHeader.FiscalYears_Id == _FiscalYear_ID) > .Where(t => t.TransactionHeader.TransactionType.Description == "Purchase") > .GroupBy(t => 1) > .Select(t => new { Weight = t.Sum(x => x.Weight), Amount = t.Sum(x => x.Amount) }) > .ToList(); >> and then I use the results in
> wt.AddRow("Purchases", q[0].Weight, q[0].Amount);
>
>if (q==null || q.Count==0) { wt.AddRow("Purchases", 0, 0); } else { > wt.AddRow("Purchases", q[0].Weight, q[0].Amount); } >