I read the mail
I separated data in mail
I searched the web and got the price of the data.
I wrote to build data
I want to choose the most expensive and cheapest and put them on queue

hi @Yurdanur_Yusuf ,

You can use the “Sort Data Table” activity to sort your data table from the cheapest (Ascending order) or from the most expensive (Descending order).

The cheapest/most expensive will be at the top of the sorted data table.



DT.AsEnumerable.OrderBy(Function(x)Cdbl(x(1).ToString)).First.ItemArray //Row having Minimum Value
DT.AsEnumerable.OrderBy(Function(x)Cdbl(x(1).ToString)).Last.ItemArray //Row having Maximum value


Please share the error that you are getting in the Add Queue Item Activity.


how can i apply

hi @Yurdanur_Yusuf , do you need to go through all the rows of the data table or just pick the cheapest and most expensive in the data table and then add it to the queue?


yellow mark is your column number
yellow mark is datatype of variable

1 Like

I need to pick the most expensive and least expensive from the data table and add it to the queue.

@Yurdanur_Yusuf Column Started from 0 and I think you have 2 column only

I said 2 for column number

@Yurdanur_Yusuf do you need to check if there are rows with the same price? (for example, 3 items have the same price as the most expensive)

1 Like

no they are all different

how do i add the first and last row in the data

@Yurdanur_Yusuf Now problem is that your data contains “,” commas and “TL”
Its means you have data in string not Integer or Double.
We can’t get Max value from string

how can i get the first row from data

you can actually remove the If condition.

What I did is I sort it first in ascending order to get the cheapest then I add the queue item. after that, I sorted it into descending order to get the most expensive then I add the next queue item.

Here’s my code:
SortDataTable.xaml (9.2 KB)

When prices are like this, they can’t sort correctly.
because it does it according to the first digits

Hi @Yurdanur_Yusuf,

In this case, we will remove the Sort Data table.

First, I updated the data table by replacing the “.” with “” and “,” with “.” and remove the “TL” word. We need to do this so that it can be sorted properly.

Here’s the variables for Minimum and Maximum

The we get the Minimum Value first

after that we get the Max Value

Here’s the updated code
SortDataTable.xaml (14.7 KB)

1 Like