I have what seems like a fairly simple requirement, but looking back, I can't get a simple answer. I looked at the MSDN, Exper Exchange forums and gave me nothing significant.
I have the following LINQ code
Dim SummaryLog As IQueryable(Of clPartCountSummary)
SummaryLog = From Inventory In db.tblPartCounts _
Where Inventory.InventoryCountId = InventoryCountId _
And Not Inventory.ActionId.HasValue _
Group By PartNumber = Inventory.PartNumber _
, Inventory.RevLevel, SAPLocation = Inventory.SAPLocation _
Into AggregatedProdLog = Group, Qty = Sum(Inventory.Quantity) _
Select New clPartCountSummary With
{.PartNumber = PartNumber,
.RevLevel = RevLevel,
.Qty = Qty,
.SAPLocation = SAPLocation}
I want to be able to conditionally group by RevLeveland SAPLocation. I will always group with help PartNumber, but the other two are optional. So, if the variable bRevLevelis true, then we group by RevLevel, and if bSAPLocationtrue, then we also group SAPLocation.
Any help would be greatly appreciated; I am at a stage where several definitions SummaryLogare starting to look attractive.
Thanks Tomasz