From filrst datatable cell get value , Determine whether the second column of the second data table exists

Hello everyone,
I want to ask how to use the Select method according to the column index. I now have two data tables.
I have successfully obtained a field in the first data table.
I want to go to another table, the second column.
Go to find this field, this field may or may not, I want to determine whether his column contains this value, the way I can think of is for each row and select, the first method obviously does not work, because I have more than 2w Data, that is an extremely bad algorithm in my opinion, the second option, I want to judge the number I obtained through the selection, if it is less than 1, it means no, but my table does not reflect the title , Which confuses me. I hope everyone can brainstorm.
Best wishes to everyone!

1 Like

Hi @WangJidong

Hope this method helps you resolve this
–hope you have a value obatined from first datatable with a string variable named str_input
–now use a simple assign activity to validate whether your second table has that value in its second column like this
bool_exists = dt2.AsEnumerable().Where(Function(a) a.Field(of string)(“columnname”).ToString.Contains(str_input.ToString)).ToArray().Count > 0

if true it means the second column has that value

Hope this would help you

Cheers @WangJidong

First of all, thank you for your busy response to my question.
What I want to know is the meaning of columnsname in the Linq you provided.
There is no title in my table.
Thanks again.

1 Like

Do you have any other solutions?

1 Like

ColumnName is this, your second columnname @WangJidong


I understand what you mean, thank you very much

Great @WangJidong

You are really a great developer,

1 Like

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