Returning Boolean if value in Datatable

Hey Team,

I’m writing an if statement and I’d like to check if a given value is anywhere within a column in a DataTable.

Is there some function like -> “row(0).toString In Datatable” that will return “True”?

we can mention like this in the IF condition
make sure that IF condition is placed within the FOR EACH ROW activity

Cheers @Jayant_C

I was asking moreso for checking if a value is in a datatable. For example I have a For Each activity iterating through TableA and I need to check if the row(0).toString matches ANY value within the first column in Table B.

Your solution seems like it would work only to check for a single value.

Try this:

1 Like

Hmm…but this was not mentioned in the query like we need to check with another Table
so to do we can use Lookup datatable activity as @x.Rei.Ai.x suggested
Cheers @Jayant_C

1 Like

Yeah I could have been more clear. Thanks @Palaniyappan I appreciate your response.

Thanks @x.Rei.Ai.x

Greatly appreciated!

1 Like

Fine this is the step involved
–hope we got two datatable dt1 and dt2
–now use a for each row loop and pass the variable dt1 as input
–inside the loop use a LOOKUP DATATABLE activity where in the property panel mention as
–under input category
Datatable as dt1
value as row(“yourcolumnname in dt1”).ToString

–under lookup column index - mention the column index of one column in dt2 that we need to compare with our column in dt1 and usually the column index starts from 0 for the first column

–under output cell value – mention a string variable named str_output

–under Target column index – mention the column index of a column in dt2 whose value is needed as a output cell value

–to validate the value next to this lookup datatable we can use a IF condition like this
str_output.ToString.Equals(“your value”)

Cheers @Jayant_C

1 Like

I believe this is the solution.

1 Like

Cheers @Angel

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