Need help with respect to filtering the Datatable

Hi All, I am new to UIPath and facing one issue with respect to filtering of data table. Need your help on the same, I will brief my problem.

Step01:- I have a excel(sample.xlsx) and in that have date of joining colum and few other columns as well.

Step02:- “date of joining” column had data in DD-MON-YY(ex:- 30-Dec-2017, 11-Mar-2018…).

Step03- I am reading the excel data using datarange activity in to a data table( ex- dt01).

Step04- I want to filter those data from the datatable whose date of joining month and date is from last month 15th till the current system month 15th.

Ex01 - in the excel sheet under date of joining there is a record whose joining date is 16-Feb-2018 and system date/current date 19th March 2019 so this record should be filtered.

Ex02- in the excel sheet under date of joining there is a record whose joining date is 10-Feb-2018 and system date/current date 19th March 2019 so this record should not be filtered since filtering of records should happen only from last month 15th till this month 15th.

Ex03- in the excel sheet under date of joining there is a record whose joining date is 10-Mar-2013 and system date/current date 19th March 2019 so this record should be filtered.

Ex04- in the excel sheet under date of joining there is a record whose joining date is 16-Mar-2012 and system date/current date 19th March 2019 so this record should NOT be filtered since date and month exceeds current month 15th criteria.

I tried using dt01.select( diffdate… ).copydatatable this didnot work also I tried datatable filter but could not figure out how to give the conditions.

If there is any other easy way to filter the data please suggest me. thanks in advance.

Hello @sunils0505,
you can achieve this using linq queries. refer the below link for sample linq queries.

https://www.dotnetperls.com/linq

Thanks

@sunils0505 Did you try usnig filter data table wizard?

  1. Convert string that is read from Excel to date.
  2. In Filter datatable wizard, use keep/remove options accordingly.
  3. you can enter condition as ValueInDateTimeFormat , < , ValueInDateTimeFormat+30
    then, you can keep the row.
    else , it will remove the row from dt.
  4. mention the input DT and output DT in the wizard.
  5. the final DT will contain only rows that satisfy conditions you have mentioned.

Thanks,
Arun

Thanks for your quick response, I will try will let you know.

Thanks for your response, I will explore how i can give multiple values for filtering.