Extract data table: Current date -10days

How to write a statement for extracting values in a datatable where it meets current date-10days in one column

Assign: ExtractDataTable. Select("[Supp Status]= ‘LIVE’ AND [Send Date]=‘DateTime.Now.AddDay(-10).Tostring(mm/dd/yyyy)’").CopyToDataTable

It is Not working and returning no rows

@sonesh.bansal you can give like this buddy Extractdatatable.select("date<‘date to till you want to filter’ ").copytodatatable

Hi @venkatmalla6

I don’t want to give hard coded values by specifying particular date. It should filter all the values with a condition of “Current date-10days”.

Hi @sonesh.bans

Use now.tostring.Adddays(-10).to string

Use this in condition

Thanks
Ashwin.S

@sonesh.bansal ok fine,even i don’t have idea on that let’s see if any our forum members will find it. i think @lakshman @Palaniyappan can clear our query.

1 Like

No not working:

I want to filter datatable with multiple rows with following conditions in two columns where

  1. Coloumn named: Supp Status should be “LIVE”
    It is working as it is a string
  2. Column named “Send Date” should filter all the dates which are current date-10 days. It is a date column and I think we should covert this column to date first.

Fine
Kindly try with this buddy
ExtractDataTable. Select("[Supp Status]= ‘LIVE’ AND [Send Date]=#" + DateTime.Now.AddDay(-10).Tostring() + "# ").CopyToDataTable()

@sonesh.bansal

Try these steps:

In Assign, String date = DateTime.Now.AddDays(-10).ToString(“MM/dd/yyyy”)

ExtractDataTable.Select("[Supp Status]= ‘LIVE’ AND [Send Date]=’"+date+"’").CopyToDataTable

For your reference, please find the sample example.

Main.xaml (7.5 KB)

@lakshman

Check this file:

Main.xaml (21.5 KB)

1 Like

@sonesh.bansal

What error are you getting ?

Have you checked my workflow or not ?

@lakshman

Yeah I have checked, you have build data table and assigned “Name” and given a desired value by declaring a variable.
My date column name from the scraped data is “Send Date” which is not a valid variable name.

Error from my workflow above: No rows in source data
I have the rows count of 90 when in ExtractDataTable.

FinItems is working for all columns except Send Date for which I am not able to filter

@sonesh.bansal

If possible, Could you please show me sample input data you are processing.

@lakshman

Sorry I cant share whole date, its confidential.

But For example:

Send Date
05/31/2019
06/07/2019
06/12/2019

06/12/2019

Column also contains null values

@sonesh.bansal

Please check below example for your reference.

Main.xaml (7.6 KB)

@lakshman

Please modify your data table in your example and try with the following three columns:

Supp Status Send Date Status

LIVE 05/31/2019 Ready
LIVE 06/07/2019 Ready
LIVE 06/12/2019 Ready
LIVE 06/12/2019 Ready
LIVE Ready
LIVE 06/18/2019 Ready
SENT 06/18/2019 Ready

Could you please try with the above data table without changing the column names and output should be Supp Status= LIVE and Send Date= current date-10days

@sonesh.bansal

Please check below file and just changed the dates from above input data to print output result.

Main.xaml (8.1 KB)

@lakshman

Please run your workflow, it says no source data rows. That is my exact problem, now you can understand

@sonesh.bansal

It’s working fine. Today 26th June 2019 right.

If the input data contains 16th June 2019 then it will give output else it will give no source data rows.

@lakshman

How about outputting all dates( data rows) which are less than 10 days

@lakshman

I got it. Thanks much for your help

1 Like