How to filter a date?

Here is a test. I want to know the time of John when on the day I input. For example, I want output John’s time on the “2022-7-20”, which is “11:28”.
So I firstly filter the date, than filter the name. However, the result is Null.


test.zip (64.4 KB)

Please tell me how to solve :sob:

Str=DT.Asenumerable.Where(Function(r) r(“Name”).Tostring.Equals(“John”) And Also r(“Time”).To string.Contains(YourStringinputDate)).Select(Function(r1) r1(“Time”).Tostring.Split(" "c)(1)).Last()

The file is only a test, actually I need to filter a lot of data, and I need to use “for each row” to get everyone’s right time on everyday. So are there any solutions using “filter”?

DT=DT.Asenumerable.Groupby(Function(r) r(“Name”).Tostring).Select(Function(g) g.where(Function(r1) r1(“Time”).To string.Contains(YourStringinputDate)).First()).Copytodatatable

Can you tell me how to use this? I’m totally a beginner :sob:… If you can give me an example file, I would appreciate it!!!

Hi @aureolegogogo - Can you share that excel file

test.zip (64.4 KB)

@aureolegogogo - Not able to open it. please share only excel file, that would be enough

Capture

Hello @aureolegogogo

Do you need it in the excel itself or you can read the excel and get the values to a datatable variable?

If datatable can be used, then you can use filter datatable activity to meet your requirement?

https://docs.uipath.com/activities/docs/filter-data-table

excel.zip (7.2 KB)

I need to do the filter many times, and the data is complex. I think datatable can not do it. But may be it’s just because I don’t know how to use it.

Hi

Not able to open this file it’s invalid file.

Regards,
Dhanush

you can make the filtering condition of the filter datatable activity dynamic to meet this.

test.xlsx (9.7 KB)

test.xlsx (9.7 KB)
Test.xaml (14.5 KB)

1 Like

@aureolegogogo - Please refer to the attached workflow

Example.zip (13.3 KB)

Output

output

Note: To retrieve the time for a specific person the user should input the name along with the date. I implemented that in the code

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