DataTable - Filter the records from a datatable row where Date is newer than ''01/02/2018'

Filter the records where Date is newer than ‘01/02/2018’. I am using assign but i am not getting the correct results. I should be like [If row(“Date”) > ‘01/02/2018’]

@zeshanm9,

dataTable.select(“Date > ‘01/02/2018’”). CopyToDataTable.

Use correct date format based on input data.

1 Like

Yes i am using this but its not working

@zeshanm9,

Could you please show me your input data and your select query. will check and let you know.

@zeshanm9,

select query is wrong here. It should be like this: dataTable.select(“Date > ‘01/02/2018’”)

When you filter DataTable with datetime values, the filter expression should be like
“ColumnName > #”+DateTime.Tostring+”#”

Single quote is for string values, and comparison of string values disallows usages of < and > operants.

@lakshman @Kaoru_Hayashi its still not working can you please write it correctly for me.
If am using for each row
My datatable name is : ExtractDataTable
Row name is : Date
And i need row(“Date”) should be newer than 2018-02-01

@zeshanm9,

ExtractDataTable.select(“Date > ‘2018-02-01’”)

It will give you output as array of datarow. If you want output in dataTable then use copytoDataTable

Apply your values for ColumnName and DateTime:

Assign
DT= ExtractedDataTable.Select(“Date > #2018-2-1#”).CopyToDataTable
(Confirmed as functional in my environment)

Still not working

Can you provide with the error you’re getting

@zeshanm9,

Could you please share this workflow where you are scraping and applying query.

Hi @zeshanm9

Refer the below workflow and make the changes to your assign statements accordingly.

Main (24).xaml (11.3 KB)

(From x in DatatableVariable.AsEnumerable()
where cdate(x(“Date”))>cdate(“01/02/2018”)
Select x).copytodatatable