How to search if a data table contains a variable

Hello,

I am working with an excel sheet, using the read range activity to create a datatable. I would like to search the contents of the first row of the datatable using an IF activity to see if it contains a previously saved string variable.

Can anyone tell me what the expression should look like for this?

datatable name = dt_fullClientList
row name = Client Name
variable = currentClientName

Hi @DaneMcDaniel

If(dt_fullClientList.Rows(0)("Client Name").ToString = currentClientName)

@DaneMcDaniel

you want to search only on the particular column value in the first row

then use if activity

condition as

dt_fullClientList(0)(“ColumnName”).tostring.equals(“yourPrevioussavedValue”)

or if you want to check the value present at any column of the first row

condition as
dt.rows(0).ItemArray.Any(Function(x) x.ToString.Trim.equals(“YourPreviousValue”))

cheers

Hi @DaneMcDaniel ,
my eg
input
image
code



row(“Client Name”).ToString = strCurrentClientName
hope it help,

That did the trick, thank you so much for your fast reply!

1 Like

Yours worked as well for me, thank you for answering this!

1 Like

You three answered so fast, thank you for helping me!

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