gorby
(RPA Ninja)
May 25, 2025, 4:31am
1
こんにちは
UiPath Studio 2025.0.161STS Community editionのユーザーです。
都道府県市町村,読み,人口,面積
水戸市,みとし,266,965,217.32
日立市,ひたちし,163,300,225.73
土浦市,つちうらし,142,202,122.89
古河市,こがし,137,088,123.58
石岡市,いしおかし,69,248,215.53
上記テキストファイルを改行コードで区切って、String型配列を作成します。
String型配列をFor EachアクティビティでObject型配列に変換する構文は下記のとおりです。
arr_obj=item.Split(","c).Select(Function(s) CObj(s)).ToArray()
String型配列をFor EachアクティビティでDataRow配列に変換する構文はどうなりますか?
Anil_G
(Anil Gorthi)
May 25, 2025, 6:06am
2
@gorby
Use add data row activity and pass the item.split(","c) in array gield and it should add to the datatable as needed
Also whole of the text can be converted to datatable using generate datatable from text activity
Cheers
gorby
(RPA Ninja)
May 25, 2025, 9:13am
3
Hi smart @Anil_G ,Thank you for your reply!
However, I do not want to hear coverting method via datatable from String array into a DataRow array .
My question was “What is the syntax for converting a String array into a DataRow array using the For Each activity?”
Initially, I thoght a String array could be coverted into a DataRow array direcry using For Each activity.
For example, Does UiPath accept the next Syntax in For Each Activity?
arr_dr=item.Split(","c).Select(Function(s) CDataRow(s)).ToArray()
Cheers to a devout Hindu
1 Like
Anil_G
(Anil Gorthi)
May 25, 2025, 10:09am
4
@gorby
please check this on how to create a datarow and use if you dont want to use add data row activity
https://stackoverflow.com/questions/4509700/moving-from-string-array-into-datarow
or you need to use like this..here dt is the datatable which is already defined with required columns
datarowvariable = dt.LoadDataRow(stringvariable.Split(","c),False)
but because you are using loaddatarow it would load to datatable as well
or as mentioned use dt.Newrow which creates the datarow and then add each column value as you need
cheers
gorby
(RPA Ninja)
May 25, 2025, 12:25pm
5
I wonder why you show me how to make Datarow.
I want to make datarow array instead.
For example, Does UiPath accept the next Syntax in For Each Activity?
collection —> string array
currentitem → item
arr_dr=item.Split(","c).Select(Function(s) CDataRow(s)).ToArray()
Anil_G
(Anil Gorthi)
May 25, 2025, 2:24pm
6
@gorby
But its not a datarow array ..ideally isnt each comma separated value belongs to single row?
If you want to make satarow array then no need of for loop also..
Basically dt.AsEnumerable.ToArray will give you datarow array..item.split.select will select each item or string a single element..
If you need to convert as datarow array then split should be on newline as pwe your sata..and inside select split with comma and then convert or load as datarow then those are treated as ienumerable which is array
Cheers
gorby
(RPA Ninja)
May 25, 2025, 8:34pm
7
Hi, devout Hindu, @Anil_G ,
Probably, my expected answer was “No, you cannot make datarow array using the following syntax.” instead of redundant long sentences.
arr_dr=item.Split(","c).Select(Function(s) CDataRow(s)).ToArray()
Cheers with my chai
1 Like
Anil_G
(Anil Gorthi)
May 26, 2025, 6:04am
8
@gorby
But your question was different..should have asked if this syntax works or not..but you asked for working syntax for datarow
Cheers
gorby
(RPA Ninja)
May 26, 2025, 6:42am
9
However, it turend out there are no working syntax. No way.
Cheers with my chai
1 Like
system
(system)
Closed
May 29, 2025, 6:43am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.