Hi @ppr thanks for the demo xaml. The compile time error is gone now. I have also realized that we should only use Invoke Code activity instead of Assign activity(Thanks to @lakshman too).
I am now facing a different problem. Which I am trying to resolve. Would be great if yourself or anyone could pitch in for that too.
I am trying to use this logic suggested to convert a string column have DateTime values in Datatable to custom Date format. But I am getting an error in the Invoke Code activity
dtDateFormatColumn.AsEnumerable().ToList().ForEach(Sub(x) x.SetField(“Start Date”, CDate(x(“Start Date”).ToString()).ToString(“M/d/yyyy”)))
I have tried the below code as well -
DataTable.AsEnumerable.ToList.ForEach(Sub(x) x(“Start Date”)= CDate(x(“Start Date”).ToString).ToString(“M/d/yyyy”))
Error Message -
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ----> System.InvalidCastException: Conversion from string “” to type ‘Date’ is not valid.
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDate(String Value)
The error seems to point to the Date conversion, but when I tried for a sample data, it works like a charm -
CDATE(“1/1/2019 12:00:00 AM”).ToString(“M/d/yyyy”)
Any suggestion would be much appreciated!