Here is what to include in your request to make sure we implement a solution as quickly as possible.
1. Description
I'm using OrderBy together with GroupByMany, but my elements does not get ordered correctly. When I print out the elements in each subGroup the Dates are NOT sorted, but jumping around.
var sel = invoiceLines.AsQueryable().**OrderBy**("BusinessUnitId", "CustomerId", "DeliveryAddressId", "Date").**GroupByMany**("BusinessUnitId", "CustomerId", "DeliveryAddressId", "Date").ToList();
foreach (var group in sel)
{
Traverse(group, 0);
}
----
Traverse(GroupResult group, int indent)
{
if (group.Subgroups != null)
{
foreach (var subgroup in group.Subgroups)
{
Traverse(subgroup, indent + 2);
}
}
foreach (var value in group.Items)
{
var invoiceLine = value as InvoiceLineDB; // Replace InvoiceLine with your actual type
if (invoiceLine != null)
{
System.Diagnostics.Debug.WriteLine($"{new string(' ', indent)} BusinessUnitId: {invoiceLine.BusinessUnitId}, CustomerId: {invoiceLine.CustomerId}, DeliveryAddressId: {invoiceLine.DeliveryAddressId}, Date: {invoiceLine.Date}, {invoiceLine.Description}"); // Replace with your actual logic
}
}
}
Here is what to include in your request to make sure we implement a solution as quickly as possible.
1. Description
I'm using OrderBy together with GroupByMany, but my elements does not get ordered correctly. When I print out the elements in each subGroup the Dates are NOT sorted, but jumping around.