Search from DT if found put "Yes"

I have a String=“Bat Ball Pen Chair Book Laptop”.
I have created a DT in that 4 columns are there (Things 1,Things 2,Things 3, Found).
Please check snap shot.

I need to search from 1st row that if any word from the 1st row is in the string if yes then I have to write “Yes” in Found row into DT only NOT EXCEL.

Search Found


Read Range into datatable
For Each Row in datatable

  • If myStr.Contains(CurrentRow(“Things 1”).ToString) OR myStr.Contains(CurrentRow(“Things 2”).ToString) OR myStr.Contains(CurrentRow(“Things 3”).ToString)
    – Then Assign CurrentRow(“Is Found”) = “Yes”
    – Else Assign CurrentRow(“Is Found”) = “No”

Note that Contains is case sensitive. If you want it to ignore case, then just do…

If myStr.ToUpper.Contains(CurrentRow(“Things 1”).ToString.ToUpper) OR myStr.ToUpper.Contains(CurrentRow(“Things 2”).ToString.ToUpper) OR myStr.ToUpper.Contains(CurrentRow(“Things 3”).ToString.ToUpper)

we can reduce the concatenating ORs with

{"Things1","Things2","Things3"}.Any(Function (x) strCheckString.Contains(CurrentRow(x).toString))


CurrentRow.ItemArray.Take(3).Any(Function (x) strCheckString.toUpper.Contains(CurrentRow(x).toString.ToUpper))

Hi @Gagan_Chaudhari Please try the below code
Sequence.xaml (10.9 KB)

Your expressions look backwards.

“Pen” doesn’t contain “Bat Ball Pen Chair Book Laptop”

“Bat Ball Pen Chair Book Laptop” contains “Pen”

not sure if I got you. statement is implementing the same logic as yours:
use the check string and check with a contains for the row value.

My bad, I read it wrong the first time. You’re right, and that’s a cool solution for this kind of situation.

Ok. However thanks for cross checking, I am a human and wrong things can occur :+1:


Thanks @KIRTI_IYER for code.In this what if user Input(varInput) any specific value and I need to Check that specific value ?

Sharing the snap shot of My xaml.

TempResume has whole string (from I have to find the words)

DT has 5 columns (Terms, Alternative 1, Alternative 2, Alternative 3, Found?)

I use this expression {“Terms”,“Alternative 1”,“Alternative 2”,“Alternative 3”}.Any(Function (x) TempResume.Contains(CurrentRow(x).toString))

in If , Don’t know whether I am using it right or not.

Can you please guide me.

Simply need to find the Words those are in Terms, Alternative 1, Alternative 2, Alternative 3 from TempResume String.


It looks correct. In the Then sequence you can also add CurrentRow("Found?") = "Yes".

Beware though that String.Contains() will also give you partial matches. E.g. TempResume.Contains(“Engine”) returns true since it’s a partial match of “Engineer”. If you don’t want partial matches, you need to either split TempResume to an array first or use regex instead.

1 Like

Thanks to verify the code, Exactly which activity do I need to use for CurrentRow.Item(“Found?”) = “Yes”
because I need to write that Yes value in “Found” column for that row in excel to create the report

Use the Assign activity. This will modify the value in your data table only. Then use Write Range to write it to Excel.


I kept the value of TempResume = “prepare”
which is not in my list, it’s still giving yes FOR ALL THE ROW’s.

Do you have empty cells in your data table? TempResume.Contains("") returns true.

Yes .
Tabel ----------…---------------…


Then you will need to remove the empty cells before comparing it with TempResume.

{"Terms","Alternative 1","Alternative 2","Alternative 3"}.Where(Function(c) Not String.IsNullOrWhiteSpace(CurrentRow(c).toString)).Any(Function (x) TempResume.Contains(CurrentRow(x).toString))

1 Like

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