gorby
(Extraordinary UiPath Forum Contributor 2024)
1
こんにちは
UiPath Studio 2025.0.167STS Community editionのユーザーです。
1.やりたいこと
データテーブルdt_inputのインデックス2番目の行を別のデータテーブルdt_input2に挿入したい。
2.困っていること
arr_dr=dt_input.Select()
dr_work=arr_dr(1)
を代入文で実行後、
InvokeMethodアクティビティでInsertATメソッドを実行すればできそうですが、
別案として、
dr_filteredRows = dt_input.AsEnumerable().Where(Function(row, index) index = 1)
dt_input2 = dr_filteredRows.CopyToDataTable()
を実行してみましたが、1行目で添付のエラーが出ました。1行目をどう修正すればよいでしょうか?
@gorby
What is your dt_filteredRows variable type?
mostly it will be the data type issue.
gorby
(Extraordinary UiPath Forum Contributor 2024)
3
No.My suggested variable is dr_filteredRows NOT dt_filteredRows.
dr_filteredRows is DataRow.
@gorby
That Variable type not be Datarow you need to change to IEnumerable(Of DataRow) or
you can use in one line instead two lines of code
dt_input2 = dt_input.AsEnumerable().Where(Function(row, index) index = 1).CopyToDataTable()
Happy Automation!!
gorby
(Extraordinary UiPath Forum Contributor 2024)
6
Hi,Thank you for your advice!
After changing variable type from Datarow Array to IEnumerable(Of DataRow),
I confirmed the next two lines work.
IEdr_filteredRows = dt_input.AsEnumerable().Where(Function(row, index) index = 1)
dt_input2 = IEdr_filteredRows.CopyToDataTable()
1 Like
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.