Check lowest value from price field and type into quantity field on the website

Hi Everyone.

Sorry for re-sending this topic.

I want to check some price field to determined the lowest price, and then input quantity into the quantity field on the website.

The price field and quantity field have selectors as attached txt file…

How to do that ?

Thanks in Advance! Selector.zip (295 Bytes)
FILE.xaml (12.5 KB)

Hello @trunghai

I just have an idea
Scrape all the price and then sort the table in ascending order…then first element will your lowest price

Regards
Ajay

2 Likes

Hi @Ajju

Thanks you for your suggest… but it take a long time because I have many items must be check lowest price and then key in their quantity on the web.

I have made a counter variable and assign it into the selector . But I don’t know how to determined the lowest price when selector run one by one price field and then key in into the quantity field.

Pls check in my XAML file.FILE.xaml (12.5 KB)

@trunghai

how you check the price is lowest or not manual?

is there comparison between two items or number of item ?

if possible share the link of the website and more details about the comparison

1 Like

Hi @Ajju

Sorry bro, the website is internal web and could not access from outsite.

I want to use selector + counter variable to check all of Price Fields to find out the field has lowest price and then type into the quantity field.

The price and quantity field have the same index “0,1,2” when use the counter variable to count.

@trunghai

ok bro then do like below

– get the price assign it to a variable called lowestPrise
– get the second value, compare it with the first value
– if second value is lowest than the first then assign the second value to lowestPrise variable
– continue this procedure for all the value but it might need you to do it two loops.

so better scrape all the value using data scarping sort it get the lowest it will be faster than comparing the values one by one.
to find the element after getting the lowest you just need to get the index of the lowest price in the original table not the sorted one.

1 Like

Hi @Ajju

Thanks you Bro.

It very easy if it has two price fields, but here is many price fields.

The selector of Price & Quantity fields as attached file.

Could you pls make a xaml sample file for this based on that selectors ?

Thanks you!
Selector.zip (295 Bytes)

@trunghai

if i do it by assumption, it will not work for you

just implement it like a bubble sort algorithm it will definitely work

Happy development

Ajay

1 Like

Thanks you bro @Ajju

If I scrapted all of price and make datatable… I will use the For Each activity to find out the lowest price ?

What is the command to find out the lowest value in the datatable. Such as : YourList.Min(function(e) Convert.ToInt32(e))

@trunghai

no need to use for each
sort the data table in ascending order and get the first row value that will give you the lowest price

1 Like

Thanks you Bro.

But it very hard to determine the index. Because we need to determine it to know the index of quantity field for input the data.

you can take a copy of the original data table
after sorting you will get the value
from the original data table you just need to get the index of the value

i guess as you said index of the selector will 0,1,2 like that you will get the same index value from the data table.

means index value in the web page and index in the data table will be same (just assumption)

give a try

1 Like

Hi @Ajju

Hi bro, I have scrapt data with format as below picture.

Now, how to combine with sort activity to arrange and got the minimum value ?


hi @trunghai

before sorting take a copy of the datatable

in sorting , pass the data table name and column you want to sort

image

Cheers

1 Like

Hi bro.

Before sorting…write data into the excel file ?

@trunghai

yeah that is also ok or same table you can assign to some other data table variable

Hi Bro.

I have made XAML file to sort ascending and I checked the result which written into the excel file is correct.
And now how to determine the index of lowest price ( EX : 0,1,2,3… )… I think it very hard.FILE.xaml (18.0 KB)

hey i have checked your code, but take a backup of the original data table (before sorting) then sort it.
Datatable1 = Datatable

from sorting you will get a data table .

lowest price = datatable.rows(0).item(0).tostring ///will give you the lowest price.

to get the index

For-Each row in datatable1 //////(copy of the original)
{

if (cint (row.item(0)) = cint(lowest Price))
{
index = datatable1.Rows.IndexOf(row)
}
}

1 Like

Hi Bro.

Thanks you Bro.

Sorry for late reply. The result will got the index of row after sorting.

But we need to got the index before sorting to know the original index from website.

I think we need to determined the lowest price before sorting… We can use For Each Row to got the lowest price ?Sort Data.xaml (20.5 KB)

hi @trunghai

i have made the changes
try it

Sort Data.xaml (19.1 KB)

1 Like