I’ve been stuck at this problem for a while.
Hope you can help.
I have a datatable which is created trough a excel application scope // read range activity from an excel file.
This excel file consists of the following:
Name Value Description
Date1 01-01-2020 Jan
Date2 10-01-2020 Jan
Date3 10-01-2020 Feb
Date4 13-02-2020 Feb
Date5 13-02-2020 Mar
Date6 12-03-2020 Mar
etc. etc. etc.
What I am trying to do is compare a series of dates (which are located in another datatable) and determine the corresponding description for those dates. I then want to see if this description value matches the one in the datatable from the excel file and return a boolean value.
For example, I am given a date of 10-01-2020 and a date of 15-02-2020.
Todays date would be 03-02-2020.
I would expect the value of 10-02-2020 to have a description attribute of ‘Feb’.
The date of 15-02-2020 would have a description attribute of Mar .
10-01-2020 would return true because its value is feb under description and todays date being 03-02-2020 the current month is feb, 15-02-2020 would return false because this date is after and its value is mar.
How would I realize this in a sequence?
My idea was to use an inner for each loop on on the series of dates and an outer for each loop on the items from the datatable which comes from the excel table.
Then filtering via linq, but I cant get my code right. I have;
dtFromExcelFile.AsEnumerable and I am stuck after this.
Hope my story makes sense.