How to add array to datatable

  1. I have two arrays
  2. I want to add them in datatable
  3. The data table have 2 columns
  4. I want add 1st array in 1st column & 2nd array in 2nd column.
  5. Both array values corresponding to each other
    how can i do this?

Hello @pravin_bindage

You can try using the Collection to Datatable activity.

image

Thanks

i’m not getting


i want that 2nd column values corresponding to 1st column

i used for each to iterate that array & add values to datatable by using add data row

@Gokul001 @Anil_G do you have any idea?

hi @pravin_bindage

Kindly Share Image or Screenshot of your Input and your expected output

Regards
VP

Hi @pravin_bindage

  1. Build Datatable with 2 columns
  2. Use for each on first array and use add data row
  3. Use one more for each on second array but now use assign instead of add datarow and in for each you have an index property assign a int32 type variable to it(index)
    dt.Rows(index)("Yoursecondcolumnname") = currentitem

I believe you used add datarow also in second loop

cheers


i need output like this
input is 2 array
Arrays contains that column values

yes i used

@pravin_bindage

in the second array loop as I said do not use add datarow …add the data using assign as I specified above

cheers

2nd column is blank its not writing

Hi @pravin_bindage

I hope both array are of same length then directly us the below

  1. Use for each with in argument as enumerable.range(0,array1.count()-1).toarray and chnage type argument to int32
  2. Use add datarow with array as
    {array1(currentitem),array2(currentitem)}

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.