Datatableから特定の値がある行数を取得したい

あるWebからデータスクレイピングにてDataTable型で値を取得し、
その中から特定の値(test2@gmail.com)がある行を特定したいのですが、やり方がわからず…。

test1@gmail.com
test2@gmail.com
test3@gmail.com

上記のようなDataTableが取得できたので、2行目の[2]という値を取得したいです。
Write cellで ExtractDataTable.Select(“test2@gmail.com”).ToString と設定してみたのですが、

メッセージ: 構文エラー : ‘@ntt’ 演算子の後にオペランドがありません。
例外の種類: System.Data.SyntaxErrorException

というメッセージが出てしまいます…。
Selectを使わずFindやRows等を駆使する必要があるかもと思ったのですが、
私では答えを導き出すことができず…。
UiPathの範疇ではないかもしれませんが、どなたかご助力いただけますと幸いです。

以上、何卒宜しくお願い申し上げます。

1 Like

@saltyayumu,

Iterate above Data Table using For Each Row activity and check condition.

IF row(“EmailColumn”).Tostring.equals(“test2@gmail.com”)

Then Continue

Else Skip.

1 Like

Thank you for answering!
I will use For Each Row!

test1@gmail.com
test2@gmail.com←This!!
test3@gmail.com


How to get “line number”?..Like “2”.
What task Should I set? I’m really sorry but I don’t know…

And, please forgive my not smart questions and English.

Dear lakshman.

After check your answer, I understand problems.
Set 『ExtractDataTable.Rows.IndexOf(row).ToString』 to Assing activity,
I can get colum number!
Thanks a lot, Mr Robot Master!!

1 Like

DataTable.Select(“[行名] = ‘test2@gmail.com’”) で検索できますよ。
Assignを使えば、
(DataRow) tmpArr = dt.Select(“メールアドレス=‘test@gmail.com’”)
みたいなのができます、行数はtmpArr.Countで取得できます。

2 Likes