How to filter/remove rows from datatable if date in column is 15 days or higher from today?

Hello Friends,

A complete rookie here and i have seen threads discussing similar issues in forum but couldn’t workout a solution that i could use.
I am working on an automation where I am trying to create a report showing documents that are due (dates older than today) and that are due in next 15 days. But the parent excel has some rows which has dates that are older than 15 days and i need to remove those rows from the new datatable. I am currently taking out the data from parent excel using read range. I tried using filter datatable and also tried using a while loop as you can see in attached image. Please also find the attached parent excel and final report. You can see that the final report has some dates still remaining which are higher than 15 days from today. Couldit be because the filter datatable or while loop was unable to recognise the dates in datatable? Please help me.
Final report.xlsx (11.5 KB) Parent excel.xlsx (11.3 KB)

Hi @JIBIN_MANUAL

Use for each row in Sheet3Final

CDate(row(“Due date-customer”).ToString).equals(DateTime.Now.AddDays(15).ToString(“dd/mm/yyyy”)

Thanks
Ashwin S

Hello @AshwinS2,

Thanks for the quick reply.

I know that it sounds really lazy, but could you provide me a sample xaml file? a mechanical engineer here…:stuck_out_tongue_winking_eye:

Should i apply this to a variable or do i use remove datarow in the for each loop?

Hi @JIBIN_MANUAL

This is a condition inside for each use if condition

Thanks
Ashwin S

Thanks for the tip…

One question though.Does this code identifies just the date 15 days from now or all dates after 15 days? I need to remove all rows higher than 15 days from now.

Hi @JIBIN_MANUAL

This is from today till next 15 days

Thanks
Ashwin S

Sorry about such trivial questions, but if i need to modify the code to select all dates after 15 days or all dates till next 15 dates (including dates older than today), how it would be?
I am still learning the basics of c# syntax. Thanks for all the help

Hello,

I tried to do this sorting by taking value from sheet2 and writing in to new sheet, sheet4. Finally i was able to get the program to identify string to date but still my loop to remove the rows with dates higher than 15 days from today is not running. Could you please look into the attached workflow and try to make it work? all the necessary files are added in the zip file. @Palaniyappan @anil5 @loginerror @Rreport generation.zip (21.0 KB)