Want to select multiple items from matching row

Hello Community,

Use case I am working on:

Customer will send email with ID and OA Numbers through the day:

ID OA Name
1001572 AOH06653
1001571 AHI02708
1001570 AOH06651
1001569 AFL04667

I want to match the OA Name to another spreadsheet to get multiple information from different columns on that same matched row:

OA Name OA type Lease Number AB Code
AOH06653 leased LVA03318 7001 etc from a few more columns

Have done this using select for additional item, but not multiple and not sure if possible.
Guess I could use multiple assigns but wonder if there an easier way to capture all once.
Thank you

@PPIM_RPA

dt2.Asenumerable.where(function(x) dt1.Asenumerable.any(function(r) r(“OA Name”).tostring.trim.equals(x(“OA Name”).tostring.trim)).copytodatatable

have you tried this

1 Like

@PPIM_RPA

  1. If everytime only one row is there and that is needed then you can use filter datatable activity or look up datatable activity
  2. If multiple rows are there also you can use filter datatable activity or linq query…in both you will get multiple rows
  3. If all matched rows for each oa numbers is needed then you need to use linq …which is provided above by @Shiva_Nikhil

Cheers

1 Like

That worked perfectly. Using same type, what would I replace if I wanted to find only one item from dt2

@PPIM_RPA

arr_str=dt2.AsEnumerable.Where(function(x) dt.AsEnumerable.ANY(Function(r) r(0).ToString.Trim.equals(x(0).ToString))).toarray

arr_str is of type array of Datarow

outputstr=dt2.AsEnumerable.Where(function(x) dt.AsEnumerable.ANY(Function(r) r(0).ToString.Trim.equals(x(0).ToString))).first

outputstr is of type System.Data.Datarow

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