リスト変数をAdd DataRowアクティビティで空のデータテーブルdt_inputに1行ずつ追加したい

こんばんは
UiPath Studio 2025.0.172STS Community editionのユーザーです。

1.やりたいこと

リスト変数lis_Path List<String>を、Add DataRowアクティビティで空のデータテーブルdt_inputに1行ずつ追加したい。

2.悩んでいること

Add DataRowアクティビティで下記のエラーが出ます。どうしてでしょうか?

System.ArgumentException: Input array is longer than the number of columns in this table. at UiPath.Core.Activities.ForEachBase`1.OnExecutionFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

@gorby,

You can add only one row at a time with Add Data Row activity.

You can pass a DataRow type variable or Array like {“Your value”}

In your case do it like this.

After I applied your advice, I found a static error, String() cannot be converted to DataRow.

How can I overcome this error?

@gorby,

Make sure you are using the correct item name in the array.

Hi, it seems there is no difference between two currenttexts.

@gorby,

I’m unable to open your code so lets try this approach.

I assume your lis_Path is of datatype List<String>
image

  1. Delete the current For Each activity with it’s inner activities.
  2. Add the For Each activity
  3. Pass lis_Path in In property
  4. Add the Add data row activity again like this.

After I tried what you said, no improvement was found.

@gorby,

It’s working fine at my end. After typing just press enter or click somewhere else outside so that expression will get validated and error will ho away.

Add data row error

Working code:
List.zip (165.3 KB)

1 Like

I noted the real reason I got confused was that in the English and Japanese versions of UiPath, the order of the column array and the DataRow in AddDataRow activity was reversed.

Wouldn’t this be considered a UiPath bug?

Cheers to your Lord, Brahma

1 Like

It could be possible the difference because of Studio versions we are using. I have an older version of the studio.

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