Add data in datatable

Hello, I have few data in dictionary which were extracted from a file
dict(“Name”)= “ABC”
dic(“DOB”)= “09/09/1990”
in for loop 1 :dic(“Hobby_1”)=“Cooking”
:dic(“Hobby_2”)=“Reading”
:dic(“Hobby_3”)=“Dancing”
in for loop 2 :dic(“Favorites_1”)=“Coffee”
:dic(“Favorites_2”)=“Pizza”
:dic(“Favorites_3”)=“Shakes”
I want to add the above data in the datatable in the following way:

Please let me know how to do the same using add data row or any other method. Thanks

Build data table using Build Datatable activity with four columns.

Use Add Data Row activity to add the values to the data table created from the previous step.

Find the sample here -

I already built data table using Build Datatable activity . Just the values are not getting added the way it want. It turns out to be something like this when I use add data row activity .

You are adding in the wrong way to the data table. Try the following logic -

for index = 1 to 3
      if (index == 1)
        add data row {dict(“Name”),dict(“DOB”),dict(“Hobby_1”),dict(“Favorites_1”)}
      else
        add data row {"","",dict(“Hobby_” + index.ToString),dict(“Favorites_” + index.ToString)}
next
3 Likes

Thank you so much. It worked :grinning:

1 Like

Thank you and can you please mark my previous post as solution.

1 Like

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