Data table to Dictionary of array conversion

Can anyone help me to convert datatable to dictionary of array

I’ve list items in datatable format. I need to convert it to dictionary of array variable

Hi @Aarya_Sajeev ,

Could you maybe check with the below post :

@Aarya_Sajeev

Can you please show your final output needed

What should be the key and what should be the values?

cheers

@Aarya_Sajeev

dt1.AsEnumerable.ToDictionary(Function(x) x(0).tostring,Function(x) DirectCast(x(1),String()))

Hi @Aarya_Sajeev

dataDict(CurrentRow("S.NO").ToString())=CurrentRow.ItemArray

Variables

Hope it helps!!

Hi @Aarya_Sajeev

Create a dictionary and initialize it
dictionary = New Dictionary(Of String, Object())

Use assign activity
dictionary = dt.AsEnumerable().ToDictionary(
Function(row) row(“YourKeyColumnName”).ToString(),
Function(row) row.ItemArray)

Hope this helps