Hi, I have a list of time in a column called “Requested On” and I keep getting this error saying that
“Assign count: String was not recognized as a valid DateTime.” where my activity “Assign count” is getting this error in my workflow. I have completely no idea where and why this error came from.
Hi
Hope theses steps would help you resolve this
—let’s take like we have read this excel with READ RANGE activity and obtained the output with a variable of type datatable named dt
—now use FOR EACH ROW activity and pass the above variable as input
—inside the loop use a assign activity like this str_input = Split(row(“yourcolumnname”).ToString,” “)(0).ToString.Trim
—then another assign activity like this Str_input = Split(str_input,”/“)(0).padleft(2,CChar(“0”))+”/“+ Split(str_input,”/“)(1).padleft(2,CChar(“0”))+”/“+ Split(str_input,”/“)(2)
—then inside the same loop a final assign activity like this dat_value = DateTime.ParseExact(str_input,”MM/dd/yy”,System.Globalization.CultureInfo.InvariantCulture)
Where dat_value is a variable of type DateTime
for this, because I am using read CSV activity however I send the file here as xlsx type as here does not allow me to upload CSV file type. U may need to convert the file type to CSV when testing it.
Sorry for the trouble.
This is my original expression: input.AsEnumerable.Where(Function(r) datetime.ParseExact(r(“Requested On”).ToString.Trim,“M/d/yy h:mm:ss tt”,nothing) >=date_before And datetime.ParseExact(r(“Requested On”).ToString.Trim,“M/d/yy h:mm:ss tt”,nothing)<=date_now).CopyToDataTable
This expression work fine when my Requested date is this
However, I input another source file which “Requested On” Column display this
I had change the Date method accordingly thus this error occur.
dt = input.AsEnumerable.Where(Function(r) datetime.ParseExact(r(“Requested On”).ToString.Trim,“M/d/yy h:mm:ss tt”,nothing) >=date_before And datetime.ParseExact(r(“Requested On”).ToString.Trim,“M/d/yy h:mm:ss tt”,nothing)<=date_now).CopyToDataTable
I had no idea why this error is coming out and how does this error came out since the DateTime is matching according to the xlsx file.
I had tried my best to explain, hope that u can understand the issue I am facing