Filter Data Table using the Time Value?

Hello Everyone,

I am trying to filter the data table to get the rows, if the Value of the column E is greater than 8:30 AM.

Will it be possible with the Filter Data Table?
FilterByTime

If yes please guide me to achieve the desired.

Thanks a lot in advance.

1 Like

Hello @winningvish
Use select method to filter data table like
Datatable.select(“column name> ‘8:30’” )

Thanks

2 Likes

Hi Sandeep ,

Thank you for your quick reply. But How can write those selected data rows to excel sheet.
Write range activity is throwing an error : Data Row cannot be converted to Data Table

Regards
Vishnu

1 Like

@winningvish

use CopyToDataTable method

dt_WIs.Select(“column name> ‘8:30’”).CopyToDataTable

Thanks

1 Like

DailyDT.Select(“1 > ‘8:30’”).CopyToDataTable

Which is unable to take the : in 8:30

Assign: Cannot interpret token ‘:’ at position 7.

@winningvish

could be try this

dt_WIs.Select(“1>”+“8:30” )

or
store 8:30 in variable then use that variable in select method

Thanks

Hello @winningvish
You can use Linq Here
Take an Assign Activity and assign this code to a Datatable Type variable

DT.AsEnumerable().Where(Function(r) (cdbl((cdate(r("Date"))).ToString("HHmm"))>830) ).CopyToDataTable

Hi winningvish,have u got the result.Please let me know.
Thanks a lot in advance.

Hi Suma,

Yes I have got the result.

Please find the below steps…

  1. Use Read Range to save the data into DataTable_Variable1

  2. Use For Each Row Activity and Inside it use Assign Activity
    2.1 row.item(“ColumnA”)= TimeSpan.Parse(row.Item(“ColumnA”).ToString)

3.Now filter the “ColumnA” by using Select Method in Assign Activity.
3.2 DataTable_Variable2=DataTable_variable1.Select("[ColumnA] > ‘8:30:00’").CopyToDataTable

Timeparse
late

Hope it will work for you.

Regards
Vishnu

cant we use Filter data table wizard to filter data for time

Can u please that .xmal file.So that i can refer that

Hi Suma,

yes, you can use Filter Data Table too.( If you are getting the desired output)

I have used Filter Data Table but I didn’t get the desired output. So I have used Select Method, which worked as expected for me.

Regards
Vishnu

Hello winningvish,
Thanks for your information.
Please do share the .xmal file

Please find the attached

Absentees_LateComers_Check.xaml (163.5 KB)

Regards
Vishnu

This is my workflow

i am getting TimeSpan error

Would you please share your XAML file if possible?

HR1.xaml (8.8 KB)

Excel

Is it possible to share the excel for clear understanding of the format of that column?

Sorry winningvish, It’s a confidential thing. But the above screen shot which i’ve sent, containing intime is column4.
Please find me the solution.