Check for the existence of a value from Datatable (return value: Boolean type)

As shown below, I am doing a check to see if a certain value exists in a certain Datatable column, and the return value is stored in a variable of type Boolean.

I’ve checked by outputting the value to be searched, the Datatable, and the column name, and I’m pretty sure that the value to be searched exists in the corresponding column of the Datatable, and the return value should be True.

  • Dt_TDI_PL OK
  • column name: 科目 OK
  • search target: item_formula.ToString.Substring(1): OK

:arrow_right:So I am wondering if there is something wrong with the following equation.

And I’ve tried all of the following methods, and they all return a false return value. I just couldn’t find where the problem was. Can someone please help me?

  1. Dt_TDI_PL.AsEnumerable.any(Function(row)row(“科目”).ToString.Trim.Equals(item_formula.ToString.Substring(1)))

  2. Dt_TDI_PL.AsEnumerable.any(Function(r)r(“科目”).ToString.Trim=(item_formula.ToString.Substring(1)))

  3. Dt_TDI_PL.AsEnumerable.any(Function(r)r(“科目”).ToString.Trim.contains(item_formula.ToString.Substring(1)))


But before going for alternative way Make sure your Substring expression is mentioned as expected

And Try in the other way around

Like this

Dt_TDI_PL.AsEnumerable.any(Function(r) item_formula.ToString.Substring(1).Contains(r(“科目”).ToString.Trim))

Again Make sure your Substring expression is mentioned as expected

Cheers @111962


Hi ,

The Lookup Datatable activity can be used to check the value in particular column . it would return the index value etc . So if the value is less than 0 it can be considered as not there.

1 Like

Hi @111962

if you need to compare each value then!

Refer the xaml below.

Main.xaml (9.2 KB)


1 Like

Thank you for your xaml file.
When I open this file, there is an error, cloud you tell me the missing activity name? so I can download this activity package. Thank you!!!

Hi @111962

Please refer to the screen shot below!


1 Like

Thank you for your quick reply.
I thought the Substring expression was mentioned as expected.
and I run the following expression, It worked.

Dt_TDI_PL.AsEnumerable.any(Function(r) item_formula.ToString.Substring(1).Contains(r(“科目”).ToString.Trim))

It was the cause that left a blank space. I apologize for that.
And Thank your very much.

1 Like



1 Like

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