Compare content of List and Data Table

Hi All,

I have a “list of String Array” and a “Data table”. I want to compare whether the content of both are exactly the same.
I am trying to convert the ‘list of String array’ to ‘Data table’ and compare but couldn’t.
Requesting your help in comparing the content of both (‘List of String Array’ and ‘Data Table’).

Thanks in advance.

Regards,
Shahidh Aqeel. S

@shahidh.aqeel.shahul

Check below for your reference

Hope this may help you

Thanks

Hi @shahidh.aqeel.shahul

Could you be more brief on your requirement as per my understanding you to match the list of string value to a datatable as data row and if it matches you need to convert the matched values as datatable right?

Regards

Hi Pravin,

I can explain in detail. I have a list of String array as below

List = List<string>(2) { string[2] { “abc”, “def”}, string[2] { “ghi”, “jkl”} }

Now, I have to convert this to a data table. Then I will be comparing this data table with another already existing data table.

Hope this gives more clarity. Incase of more details, please let me know. Thank you…

Regards,
Shahidh Aqeel. S

Hope these below steps would help you resolve this

  1. First let’s create a datatavle with two columns (as per the list input you shown us) and get the output with a variable of type datatable named dt

  2. If you have a list variable named list_in
    Then use a FOR EACH activity and pass that list variable as input and change the type argument as System.Collections.Generic.List

  3. Inside the loop use a ADD DATA ROW activity and pass the property as

ArrayRow = item
Datatavle = dt

  1. Now dt will have all the list of list items as a Datarow

  2. Now we can compare two datatable

@shahidh.aqeel.shahul

Hi @shahidh.aqeel.shahul

Use build datatable activity and create a column name of desired type string

Use for each to iterate the list of items

Then use add data row and add the items then get it as datatable

Regards

Thank you Palaniyappan… This worked.

Regards,
Shahidh Aqeel. S

1 Like

Thank you Pravin…

Thank you Srini…

Glad @shahidh.aqeel.shahul

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