Update Datatable based on dictionary

Hi,

I think it’s better to have the dictionary including datarow in advance.
For example, using the following expression.

dict = dt.AsEnumerable.GroupBy(Function(r) r("Order").ToString).ToDictionary(Function(g) g.Key,Function(g) Tuple.Create(g.Select(Function(r) r("Shipping").ToString).ToArray(),g.Select(Function(r) r).ToArray))

This way we can easily write to the finalnum to datatable just after calculated, in the loop.
Can you try the following sample?

Sample
Sample20231014-1aL.zip (3.4 KB)

Regards,

2 Likes