In between time data filter

HI to all

I am new to uipath.

i am un able to extract the data in excel by using time base.

I have a header like “Time”. The timings are “06:00:00” to “11:59:59”.
This is A-Shift data I want to extract.
Plz suggest me to come out of this.
Filter data table activity is not working properly for mainly time filtering
Capture

  • Any one Know about this.

Hi @Harish_pavuluri ,

Which rows do you want to extract? What is your filtering criteria?

@Harish_pavuluri - Please try as shown below…

image

  1. DtTime is output of Read Range

  2. DtFiltered is of Datatable type…
    3.Clone the Dttime to Dtfiltered this will just copy the schema over to DtFiltered

  3. Assign DtFiltered Code

          (From r In Dttime.AsEnumerable
         Where Datetime.ParseExact(r(2).toString.trim,"HH:mm:ss",CultureInfo.InvariantCulture).ToString("HH:mm:ss") > "06:00:00" And Datetime.ParseExact(r(2).toString.trim,"HH:mm:ss",CultureInfo.InvariantCulture).ToString("HH:mm:ss") < "11:59:59"
         Select r).CopyToDataTable
    

My Output

image

Note: I have used “Preserve Format” in the read range.

Hope this helps…

I want to extract shift time data @Shraddha_Gore

@Harish_pavuluri - I have provided the solution in my post, did you get a chance to take a look?

I am trying once i will meg you

Thnks for reply

hi

I am getting error in that.

@Harish_pavuluri - in the import tab at the bottom please import system.Globalization

Thk for support.

I am getting error for assgin activity.

@Harish_pavuluri - Please find the xaml
TimeFilter_HP.zip (44.9 KB)

It’s giving output but I need to save that data in another sheet, How can I do that.

@Harish_pavuluri - Write Range

image

Thank u I use the data table variable in write range activity its working in your excel file. but my excel the time column is in 6 position, What i did i replaced the 6 instd of 2 in logic. It is throwing error :String was not rec as a valid datetime
A-Grade Report.xlsx (204.9 KB)

@Harish_pavuluri - Yes…r(6) …if you are unsure of the column index, you can code as r(“Time”)

In both the cases it’s showing same error.

tks for reply.

Plz go throw this xaml file i am sharing and use the above excel file.
test.xaml (27.9 KB)
a valid datetime error reflecting.
Tks u support.

@Harish_pavuluri - It erroring because you original sheet time is different than what you have shared now…I am looking at it…

@Harish_pavuluri - Here you go
TimeFilter_HP_Updated.zip (281.8 KB)

The reason why my initial code was not working, in your new sheet Column “Time” is formatted as Time. When you print this you will get as shown below

0.79888888888889

To read this value you have to use the below code first…this will print the date as 19:10:24

datetime.FromOADate(cdbl(currentrow("Time").ToString)).ToString("HH:mm:ss")

Write Line Output
Without Conversion ==>0.79888888888889 After Conversion == > 19:10:24 – 1395898

678 filtered result were written in the Filtered sheet.

Hope this helps…

@Harish_pavuluri - its already written…check the Filtered sheet

Have you downloaded recent zip file attached above?

Thank you soo much for your support. it’s working now.

If I can use it for Date filtering after changing some modification on that code, I will try on my side.