Assign: Exception has been thrown by the target of an invocatio - Using Assign Activity inside for each loop

Hi,

Using 2 for each loop and iterating through two datatables. From the second Datatable matching ID values I am appending it to the first datatable. I have attached the for each xaml file. Please let me know what needs to be done. ForEachRow.xaml (12.5 KB)

@Palaniyappan

Hi @monish06

This issue normally occurs when you try to assign a null value. please cross verify to make sure that PacementID variable is not having any Null value

Please mark as solution if found useful :slight_smile:

Regards
Roshan

I already verified my placementID variable has data.

@monish06

Did you changed the UiPath version for example it was developed in a new version and changed to a older version something like that. compactability issue can also cause this.

any add datarow is there for distincttable ?

No, I didnt update anything.

Check the datatype of the column and the value getting assigned

Regards
Roshan

Can u share that datatables
?

During first iteration it is working fine. But for second iteration it is not working.

500 Test Data_5.21.2020_copy.xlsx (21.4 KB)

This is the file using and am getting the following execption.

RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.ArgumentException: Cannot set column ‘DCM Placement ID’. The value violates the MaxLength limit of this column.
at System.Data.DataColumn.CheckMaxLength(DataRow dr)
at System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs args,
DataRow eRow,
DataRowAction eAction,
Boolean fireEvent)
at System.Data.DataTable.SetNewRecordWorker(DataRow row,
Int32 proposedRecord,
DataRowAction action,
Boolean isInMerge,
Boolean suppressEnsurePropertyChanged,
Int32 position,
Boolean fireEvent,
Exception& deferredException)
at System.Data.DataRow.EndEdit()
at System.Data.DataRow.set_Item(DataColumn column,
Object value)
at System.Data.DataRow.set_Item(String columnName,
Object value)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target,
Object arguments,
Signature sig,
Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object parameters,
Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr,
Binder binder,
Object parameters,
CultureInfo culture)
at System.Activities.ExpressionUtilities.IndexerLocationFactory1.IndexerLocation.set_Value(T value) at System.Activities.Location1.ReferenceLocation.set_Value(T value)
at System.Activities.ActivityContext.SetValueCore[T](LocationReference locationReference,
T value)
at System.Activities.ActivityContext.SetValue[T](LocationReference locationReference,
T value)
at System.Activities.Argument.Set(ActivityContext context,
Object value)
at System.Activities.Statements.Assign.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)

Brother

you might have declared the datatype as int but the value getting assigned is having more bits change the datatype of placement ID column to string in datatable and see

Regards
Roshan

which is distincttable and which is
out_updatedTranscode

I want to see how workflow is running in 1 nd 2nd iteration

The issue has been fixed. I forgot to mention the maximum data length my column can accept. After increasing the length of the column the issue has been fixed. Thank you for the responses guys.

1 Like

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