Can not assign error with dates

Getting an error: Multiple Assign - Dates: Can not assign ‘DateTime.Parse(row(“EffDateRenDate”).ToString.Trim.Split({Environment.NewLine}, StringSplitOptions.None)(0).Trim)’ to ‘out_effectiveDate’.

I noticed that there is an “@” character before the dates (last screen shot). Could that be the issue?

image


image

DataTable:
image
image

Hi

Pls mention in specific like what is there in the first assign and second assign in MULTIPLE ASSIGN assign

Would like to see the expression used

@PWilliams

Yes!

If you are using Parsre function to convert a string to a date, then that string should be in a date format with no other character or text.

try removing the ‘@’ and it will convert the string to date.

1 Like

The @ sign is causing error for Parsing. you can replace the @ sign with blank space and try to parse the string to DateTime.

DateTime.Parse(MyDate.Replace("@", "").ToString)

I tried the below, but it did not work. DateTime.Parse(row(“EffDateRenDate”).ToString.Replace(“@”,“”).Trim.Split({Environment.NewLine}, StringSplitOptions.None)(0).Trim)

It looks like the @ character is outside the string value. I think this is called a verbatim string literal, which I’m not sure if its an issue or not.
image
statementDetailDT.rows(0).item(“EffDateRenDate”).ToString
@“07/01/2021
07/01/2022”

This is what is in the Multiple Assign.

DateTime.Parse(row(“EffDateRenDate”).ToString.Trim.Split({Environment.NewLine}, StringSplitOptions.None)(0).Trim)
DateTime.Parse(row(“EffDateRenDate”).ToString.Trim.Split({Environment.NewLine}, StringSplitOptions.None)(1).Trim)

The issue was due to the Split({Environment.Newline},). Chrome does not recognize Environment.Newline so I had to use Split(CHR(10)) to split the two values at the “new line”.

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