Need to filter datatable based on 3 three dates

Hi Community,

I’ve below attach excel sheet
Book1.xlsx (1.2 MB)

I need to filter it based on the below 2 conditions:

  1. If status is ABC Completed.
  2. IF Current day is Monday than filter the Completion dates based on Friday,Saturday,Sunday.

After this filteration, data table can also be empty.
Please suggest some sol related to this.

Hi, please do this step:

  1. Read range workbook

  2. Create variable to check current day
    drag assign activity and create currentday variable.

  3. Then use If condition if currentday is Monday, then in the Then section, use the Assign Activity to filter the datatable. in assign use read range output variable

dt = dt.AsEnumerable().Where(Function(r) r(“Status”).ToString = “ABC Completed” AndAlso (DateTime.Parse(r(“Completion Date”).ToString).DayOfWeek = DayOfWeek.Friday Or DateTime.Parse(r(“Completion Date”).ToString).DayOfWeek = DayOfWeek.Saturday Or DateTime.Parse(r(“Completion Date”).ToString).DayOfWeek = DayOfWeek.Sunday)).CopyToDataTable()

Hi @siddhi ,

Could you also let us know what should be done if the current day is not Monday ?

Hi @siddhi
Try this .xaml

forum.xaml (11.7 KB)

Thank you

Hi @siddhi
Try This :-
Assign a data table and paste the below query
DT.Select(“[Date Column] >= #”+Dates.ToString +“# AND [Date Column] <= #”+Dates2.ToString+“#”).CopyToDataTable
Where Date Column is the column of your Datatable containing Date
Dates and Dates2 are the variables with datatype date time.

Hi @supermanPunch ,

If current day is not Monday , then data table should be blank.

As I explained above.


Thanks all for the reply.

1 Like

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