Target Invocation Exception

I’m trying to add apostrophe to rows of particular column using foreachrow activity.But when I use assign activity to do that, it is throwing me an Target Invocation Exception.I tried to catch the exception using Try Catch activity. But it is returning me the row value without apostrophe. The whole point of adding this apostrophe before row value is; when I write this data table to excel, I don’t want format of the excel cell to be changed to number from text.

Any help or suggestion would be really appreciated.

Thanks,
Philip

1 Like

Fine
Can I have a screenshot on how we are mentioning that inside the for each row loop if possible
Cheers @pmaddala

Thanks for your prompt response @Palaniyappan.

Here it is.

1 Like

I found this good
hope this would help you as well

Kindly revert back for any queries or clarification
Cheers @pmaddala

Still no luck mate.

Here is the error.
Source: Assign

Message: Exception has been thrown by the target of an invocation.

Exception Type: System.Reflection.TargetInvocationException

RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.ArgumentException: Input string was not in a correct format.Couldn’t store <'12.10> in StartingWage Column. Expected type is Decimal. —> RemoteException wrapping System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Convert.ToDecimal(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToDecimal(IFormatProvider provider)
at System.Data.Common.DecimalStorage.Set(Int32 record, 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.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRow.set_Item(Int32 columnIndex, 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)

1 Like

I still wonder why so
Kindly share the xaml file with project.json file all together in a zipped folder if possible
Cheers @pmaddala

Thank you very much @Palaniyappan.But i found the solution for my scenario.
It couldn’t store number into datatable with apostrophe because the expected type is decimal.

I changed the data column type from “Decimal” to “String” and tried the for each activity to append apostrophe.
That worked.

Great
Cheers @pmaddala

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