Bug Report - Filter a datetime column in a datatable using select query

I have been trying to filter a column that has date time values. Using the select query gives rise to the following bug which I have been able to replicate:

Here’s the assignment. I have a datatable with the following datetime values in a column:

Start Date
4/17/2020 9:20:46 AM
4/17/2020 9:21:01 AM
4/17/2020 9:59:14 AM
4/17/2020 9:59:34 AM
4/17/2020 9:59:49 AM
4/17/2020 9:59:57 AM
4/17/2020 10:00:12 AM
4/17/2020 10:00:20 AM
4/17/2020 10:00:27 AM
4/17/2020 10:00:34 AM
4/17/2020 10:00:41 AM
4/17/2020 10:00:48 AM
4/17/2020 10:00:56 AM
4/17/2020 10:01:03 AM
4/17/2020 10:01:10 AM
4/17/2020 10:01:18 AM
4/17/2020 10:01:25 AM
4/17/2020 10:01:32 AM
4/17/2020 10:01:39 AM
4/17/2020 10:01:55 AM
4/17/2020 10:02:11 AM

I now wish to filter dates that are later than 2020/04/17 09:57:00

I referred to @Mateus_Cruz suggestion on this thread to construct the following query:

dt_RobotSchedule = dt_RobotSchedule.Select(“[Start Date] >= #”+ PeriodInit.ToString + “#”).CopyToDataTable

However, the output looks like this:

image

You can notice how the dates 9:20 and 9:21 should be filtered out, but aren’t.

I’ve attached the workflow file here for your reference: FilterDateTimeInDataTable.zip (27.6 KB)

I tried to replicate this issue in visual basic, but I could not. So I suspect that it is a UiPath problem.

@Mateus_Cruz @loginerror @uipath Can you please look into this and let me know what you think?

1 Like

Hi @anupamck

It looks like your Data Table column needs to be of type DateTime for this to work.

I was able to fix it by parsing your StartDate column of type Object to a new column of type DateTime.
Then, the filtering worked (I reversed the condition so that you can clearly see the result):

See the attached project for reference:
FilterDateTimeInDataTable.zip (8.8 KB)

5 Likes

This makes sense! Adding a new column of type DateTime resolved this issue.

Thank you, @loginerror, for your timely support :slight_smile:

1 Like

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