Lookup Partial Value and find target row index

Hi Guys.

I’m looking for a method of looking up a string in another datatable and finding a match. The string im using for the lookup is only a part of the string it needs to match with. Furthermore the matched string is not the desired value, it’s just the index of the row i want to return something else from.

What would be a good method here?

Hi @Mads_Commerou

Could you please elaborate more. If possible share some sample input and screenshots

have a look on the lookup datatable activity or lets check for a custom LINQ statement

You have several solutions, for example:
You can do a for each table and for each row in the table, you make a string.Contains in the column you want, and just save the index
you can filter the table with contains the word you want ,it will return the rows that contain the word you want and then with the filtered table you can see the id of the record and look in the original table to find out index

There are two solutions out of many

I have two datatables.

Datatable 1 is used to loop through.

For each row i want to lookup row.item(“variable”). This variable will be a partial match in Datatable 2.


Datatable 1 row.item = “ABC”

Datatable 2 contains a row with = “ABCDEFG”

Datatable 1 row item = “123”

Datatable 2 contains a row with = “123152139”

This match in datatable 2 will have a row index, and this is what i need returned.

Hope that makes sense :slight_smile:


Is it fixed that the item in data table 2 will be present in a particular column or it can be in any column?

It will be fixed in column index 1.

YourDatatable.Asenumerable.Tolist.Findindex(Function(r) r(ColumnName).Tostring.Contains(YourString))

This works great. Thank you!!

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