I get this error when I try to build my datatable:
Main has thrown an exception
Source: Add data row
Message: Input array is longer than the number of columns in this table.
Exception Type: ArgumentException
System.ArgumentException: Input array is longer than the number of columns in this table.
at System.Data.DataTable.NewRecordFromArray(Object value)
at System.Data.DataRowCollection.Add(Object values)
at UiPath.Core.Activities.AddDataRow.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Here’s the project i’m working on: Main.xaml (24.4 KB)
Hi,
Your data table column count and your add data row value count may be different…
Or
Create data table by using new datatable
Then by using add data column activity add required column
Then using add data row activity add row to datatable
I also met that error before when I create a new datatable and add new data row to it.
The reason of that error is the number of elements in input array is bigger than the number of columns in datatable. So I think you should write line those number to check that. They must be equal to work properly.
Your datatable has 4 columns, but your array contains more than 4 values.
So the problem is at your array of value.
It should be something like this: arrayrow = {“value1”,“value2”,“value3”,“value4”}.
Hope this help.
I have tried {“bnetOrderTable”,“bnetTimeStampTable”,“bnetProductTitleTable”,“bnetGameKeyTable”} in the ArraryRow Input box.
Still throwing an error:
Main has thrown an exception
Source: Add data row
Message: Input array is longer than the number of columns in this table.
Exception Type: ArgumentException
System.ArgumentException: Input array is longer than the number of columns in this table.
at System.Data.DataTable.NewRecordFromArray(Object value)
at System.Data.DataRowCollection.Add(Object values)
at UiPath.Core.Activities.AddDataRow.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Here’s the project i’m working on: Main.xaml (24.4 KB)
Hi, @Bradley_Mckinnon
In your flow you are creating 4 add data column activity only. That mean only 4 column available in datatable(bnetinfo table)
But in add data row activity you are try to insert 8 column … in datatable
That’s showing error Regards,
When you checking column count
you can identify how many columns in your datatable…
In case that value less the 4 you may make mistake in adding data column
By using that you can cross check your data row count also
By using that two you can solve your error k…
I review your workflow and found out your problem at 4 “Add Data Column” activities.
You put wrong datatable into datatable input value of those activity.
Please change that field of all 4 activities to “bnetInfoTable” value and run again.
Hope this help.
Did what you suggested, now it’s giving this error;
Main has thrown an exception
Source: Add data row
Message: Type of value has a mismatch with column typeCouldn’t store in Order# Column. Expected type is DataTable.
Exception Type: ArgumentException
System.ArgumentException: Type of value has a mismatch with column typeCouldn’t store in Order# Column. Expected type is DataTable. —> System.ArgumentException: Type of value has a mismatch with column type
at System.Data.Common.ObjectStorage.Set(Int32 recordNo, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)
— End of inner exception stack trace —
at System.Data.DataColumn.set_Item(Int32 record, Object value)
at System.Data.DataTable.NewRecordFromArray(Object value)
at System.Data.DataRowCollection.Add(Object values)
at UiPath.Core.Activities.AddDataRow.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)