Issue in filter data table to extract dates in the range of system date to (system date-28)

i want to keep those date which are fall in the range of system date to (system date-28).
i try this using filter data table. but i can not get desired result. how can i do this?

my source file is in this way-

Hi @arijit1213

Have a look to the below thread :-

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

it has done using linq query. but i want to do using filter data table.

@lakshman please help me to solve this.

date_filter.xlsx (8.5 KB)
this is my source file

Hi arijit

Try this System.DateTime.Now.add(-28).ToString(“MM/dd/yyyy”) Store this expression in date time variable and then use filter table and put that variable in that .

Hope this will help u

Sahil garg

have a look here:

the value of datacolumn is a DataType of string, but the compare should be done on dateTime base
surprisingly the statement dt1.Rows(0)(0).ToString < FilterDate works in the watch box but not in FilterTable
however it would do it on string base (Lexically order)

With a shift to the Select method the compare on dateTime base can easy be expressed
dt1.Select("[post_date] < #"+FilterDate+"#")
take notice of the surrounding #

find starter help here:
arijit1213.xaml (8.7 KB)


hi @ppr
thanks for your reply.

i write the final result in an excel but i observed that result came by removing last 28 days dates. but my requirement is to get last 28 days dates.
Thank u.

as I was quick working on your case your filter expression from above was used:

so give a try on
dt1.Select("[post_date] >= … it should let pass the filter for all dates newer the now-28 days, Also dates
newer then today.

Otherwise reformulate your filter requirements more clear if the filter result is not matching your expectations

find some starter help here:
DTSelect_FilterDateRange.xaml (7.0 KB)

hi @ppr
it work.only 1 change i had done in this part (it will be post date is grater than ). dt1.Select("[post_date] > #"+FilterDate+"#")
thank u

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