Top 50 Records from a DataTable


#1

how to get Top 50 records in a table
how to use this in UiPath dt.Rows.Cast<System.Data.DataRow>().Take(50)

i have a excel with 150 records and i loaded to a datatable, i need to get just process only 50 records per day, so i was planning to load to a datatable and process 50 record and remove the records from excel,


#2

Dt2 = Dt1.Clone

Dt2=Dt1.AsEnumerable().Take(50).CopyToDataTable()


Get top N rows from a datatable
#3

Neat solution


#4

Spammy :wink:

@vvaidya clone call is not necessary there, copytodatatable produces a new dt anyway.


#5

Agreed.


#6

Perfect, Thank you and elegent solution


#7

hello all, how about bottom 3 row? Is there any shortcut, instead of manual sort dt then use the script above?