Get Top 3 values from a column and return the rows

How do i get top 3 rows with respect to one column’s Data in UiPath ??

Thanks in advance !!

Hi,

Can you try the following expression? (Let’s say dt as Datatable)

listString = dt.AsEnumerable.Take(3).Select(Function(r) r("columnName").toString).ToList()

Regards,

I also verified the listofstring with respective index, it only returns empty values sir. @Yoichi

Hi,

The following is simple sample for this. Is there any difference with yours?

Main.xaml (7.6 KB)

Regards,

only difference is , instead of build datatable, i used a read range to read a excel file and set my output property as dT.

But still it returned empty, sir.

what should i do if i need 3 highest values of that column sir?!! @Yoichi

Thanks in advance

Hi,

what should i do if i need 3 highest values of that column sir?

If your data of the column contains non-numeric value, we need to filter it in advance.
Can you try the following?

Main.xaml (7.8 KB)

Regards,

Thank you so much sir, It works perfectly fine now !! @Yoichi
I have a another question sir, How can i get the highest 3 data (as you gave a solution now) with it’s “associated row” with the other data columns also sir ?

For example, We have Column A and Column B with it’s data which is relatable each other, so that if i have highest 3 numbers of column B , i also need It’s Respective column A data sir. Please guide !! @Yoichi

Thanks in Advance sir !!

Hi,

The following sample outputs datatable which has highest 3 data.
Hope this helps you.

Main.xaml (7.8 KB)

Regards,

Thank you so much sir ! It Worked !!

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