Want to get the data based on filter condition

Hi All,

i am trying to automate amazon website.

1- go to amazon website
2- Type mobile
3- scrap the first page(scrap mobile name and price)
4- filter dt based on price(price>7000)
5- write the filtered dt in excel

my filter dt is not working, kindly suggest the idea?

@Rakesh_Tiwari

May I know what error are you getting at the time of Filtering data ?

And also write the Data into Excel file after scraping the data and check once how the data looks like.

1 Like

Hi,

it is not filtering the data correctly, pls find the image below of filterdt wizard

image

@Rakesh_Tiwari

Can you write extracted_DT DataTable into Excel file and share me screenshot of it. Need to check once.

Hi @Rakesh_Tiwari

Can you try this Workflow?
Amazon.zip (682.8 KB)

Value = "7000"

Regards
Gokul

Hi,

You have used contains method in filter dt, but i want to write every name of mobile whose price is greater than 7000.

Hi @Rakesh_Tiwari

Can you share the Excel file

Regards
Gokul

Book1.xlsx (12.9 KB)

Hi i have shared my excel file and please refer sheet4, also attached my workflow.

FindtopFive.xaml (17.8 KB)

dt_Output.AsEnumerable.Where(function(x) Math.Round(cdbl(x(“price”).ToString.Trim),2)>7000).CopyToDataTable

Hi,

I see in your Extracted DT xml that it is defined as “Price” and not as “price”
image

Try to change the value in Filter datatable as below and see if its working.
image

Hope this helps. Cheers.

1 Like

Hi
You can check with the Workflow

Book1 (1).xlsx (13.8 KB)
FindtopFive.xaml (23.1 KB)

Hope it will work. try it & let me Know
@Rakesh_Tiwari
Regards
Gokul

Hi @Pradeep.Robot ,

when i tried changing as “Price” as suggested by you, please find the error below i got.

Can you share me your dependencies list from project.json, i am getting unresolved activities for your code.

1 Like

FindtopFive.xaml (17.8 KB)

check this one

Hi, can you try to give index no.(integer) Of column in the column field.

2 Likes

@Rakesh_Tiwari
Hey, Have you check with the Workflow?

1 Like

Hi @Rakesh_Tiwari

Check the datatype of Price, seems like it is not integer, may be int would string

So better after scrapping from amazon, write in excel using write range (Excel Application scope based ) and then read it again and then do the filter operations

Another way would be

after scrapping the datatable

use the below linq query

dt2=dt1.AsEnumerable().Where(Function(row) CDbl(row(“price”).ToString)>7000).CopyToDataTable

Try this as well

Regards,
Nived N

2 Likes

Hi @NIVED_NAMBIAR ,

i used linq query and then it worked , but still it wrote one data which it shouldn’t .

Also i don’t know about linq query.

Hi did u check the first method I suggested before linq query?

yes i tried above method also, but it is not writing the extracted data in another sheet after reading the data from Read range.