I am reading an Excel file into a data table which I am filtering using the following expression:
queueData.AsEnumerable.Where( Function(x) String.Equals(x("SignedUp").ToString.ToLower.Trim, "yes") And
String.Equals(x("IsPublic").ToString.ToLower.Trim, "yes") And
String.IsNullOrEmpty(x("Manual Handling").ToString) And
Not String.Equals(x("AnswerReceived").ToString.ToLower.Trim, "yes")).CopyToDataTable
That part works fine. However I need to add an extra dimension where I also filter on date with the following criteria:
Only include the row if
the date field is not null (data is originally read from Excel)
the difference between the date field and today’s date is less than 30 days
(from r in queueData.AsEnumerable
Where String.Equals(r("SignedUp").ToString.ToLower.Trim, "yes")
Where String.Equals(r("IsPublic").ToString.ToLower.Trim, "yes")
Where String.IsNullOrEmpty(r("Manual Handling").ToString)
Where Not String.Equals(r("AnswerReceived").ToString.ToLower.Trim, "yes")
Where Not (isNothing(r("Date)) OrElse String.IsNullOrEmpty(r("Date").toString.Trim))
Where (Now.Date - CDate(r("Date").toString.Trim)).Days < 30
Select x = r).CopyToDataTable