Inserting values in Dict(integer, list(of integer)) dynamically

Want to create a workflow that creates Key,Value pair in the run time.

for example(please see screenshot): when the loop runs first time, it will take key as 1 and value as 21 but in the second run the will chnge to 2 and its corresponding values will be 34 and 26 subsequently in the third run the key value will change to 3 and values will be 77 and 61. It will go on doing this until the last row in the data table.

Try using an Assign row(“Number”)=Row(“assigned batch”)


Can you try the following expression?

dict = dt.AsEnumerable.GroupBy(Function(r) Int32.Parse(r("Number").ToString)).ToDictionary(Function(g) g.Key,Function(g) g.Select(Function(r) Int32.Parse(r("assigned batch").ToString)).ToList)