How to fetch corresponding value in a datatable based on a value

hi good day developers, i have a question here. i have an excel table as follows


i have a variable with list of stored SO Number. based on that SO Number i want to fetch selected corresponding value which is column “Project” and column “Date”. so for example if the SO Number is SO0392406, i want to fetch its corresponding value from column “Project” and Column “Date” which is PRU01-0120 and 6/11/2019. the variable list a has many So number and i want to fetch all respective column related to that so numbers, i will be grateful for the help. thank you.

@Yusuf_Rahmaniac,

You can try with Filter datatable activity to filter and retain the required rows/values.

1 Like

Read the excel file into a datatable using Read Range activity.

For each soValue in ListSO
              dr[] = DT.Select("[SO Number]='" + soValue + "'")
              //if so number found
              if dr.Length > 0 Then
                  strProjectName = dr(0)(9).ToString //9 - column 10 (J)
                  strDate = dr(0)(1).ToStrintg //1 - Column 2 (B)
              end if
1 Like

Use if condition in a for each row loop

2 Likes

thank you for help sir. it helps for my need.

1 Like

@Yusuf_Rahmaniac You are welcome! I am glad that I could help you out.

You may try Filter datatable activity to filter or use datatable.select

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