Problem with Date Filtering a DataTable

Hi All, I am having an issue with a flow I am Creating

I have some data like this
File # Closing Date
111-1111-111 01/02/2022
222-2222-222 (blank)
333-3333-333 18/02/2022
444-4444-444 21/02/2022
555-5555-555 02/03/2022

This is imported into a datatable dtInput

image

With this criteria

image

I have then created a filter

image

And this is the result

image

I am not sure why the filter criteria isn’t working, could someone point me in the right direction please?

As per my understanding you required only date from below dt.
This will only work, if data is same format as provided.

Use code variable = yourstring.split(" "c)(1)
it will only take the date.

111-1111-111 01/02/2022
222-2222-222 (blank)
333-3333-333 18/02/2022
444-4444-444 21/02/2022
555-5555-555 02/03/2022

HI Yogesh - the Closing Date is in its own column in the datatable

Hey @ieptus !! Can you try this?

(From r in dt_test.Select()
	Where String.IsNullOrEmpty(r("Closing Date").toString) AndAlso Datetime.ParseExact(r("Closing Date").toString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) < DateCheck
	Select r).CopyToDatatable

Hope it help!

HI gabriel thanks for the reply where does this get placed?

Creat a new Datatable variable!

Does this need placing in a for each loop?

Nope! Just an assign activity!

sorry, was being a bit slow. dtResult is the filtered datatable

Yes! dt_result is the filtered Datatable

I get an Option strict on disallows implicit conversions from string to date error

Can you send a sample input file whith this data? If you are reading from excel file send it .xlsx as well.

Change your “DateCheck” variable type. Use

DateCheck = Datetime.Now As Datetime type

If I change the datecheck to datetime then I cant change the format todays date to match the imported data

The data gets saved into the datatable in the same format as displayed in the excel column

I cant send the spreadsheet as its on a remote machine

Use this if date check will always be Today’s date

(From r in dt_test.Select()
	Where String.IsNullOrEmpty(r("Closing Date").toString) AndAlso Datetime.ParseExact(r("Closing Date").toString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) < Datetime.Now.AddHours(-DateTime.Now.Hour).AddMinutes(-Datetime.Now.Minute).AddSeconds(-Datetime.Now.Second)
	Select r).CopyToDatatable

Or you can use

(From r in dt_test.Select()
	Where String.IsNullOrEmpty(r("Closing Date").toString) AndAlso Datetime.ParseExact(r("Closing Date").toString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) < Datetime.ParseExact(DateCheck,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) 
	Select r).CopyToDatatable

Using the 1st example - DateTime Now declared or within scope

Sorry Not Declared or within scope