Filter data table with enumerable

Hey,

I am having an issue while trying to filter a data table in an assign activity. I keep getting an error that says “String was not recognized as a valid DataTime”

So this is what the table looks like
A 05/08/2020
B 06/12/2019
C 04/03/2020
D 29/01/2020

I am trying to keep only the ones that have dates that are <= 13 months. This is the formula I am using. I get no errors when I type in the formula but when I run the bot it tells me it does not recognize it as a datetime:

DT. AsEnumerable().Where(function(r)(DateDiff(DateInterval.Month, DateTime.ParseExact(1.ToString.Trim,“dd/MM/yyyy”, nothing),now.Date) <= 13)).CopyToDataTable

I think you have a typo. It should be r(1).ToString.Trim if the dates are in the second column.

1 Like

I’m just a silly silly person.

Please excuse me wasting your time.

Thank you for the quick reply. After your typo fix it is working great. :slight_smile:

1 Like

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