Extract table data not working correctly

Datatablevaraible.AsEnumerable().GroupBy(Function(i) i(“columnName”)).Select(Function(g) g.First).CopyToDataTable

First try with above query if not works use below

Datatablevariable.defaultview.totable(true)

Can you use this

1 Like

the second code you gave worked but I didn’t get the result I wanted. it deleted everything that was the same with each other, I don’t want this because sometimes one or two data can be the same (the numbers you see in the picture are the price list of ford cars). what I want to do is to prevent extract table data from reading the same data more than once.

thanks for your advice.

I Think before writing it to excel use the above query so that you will get the expected output

Cheers

1 Like

I guess you didn’t understand what I said, let me explain with an example. extract table data writes a 2016 model vehicle with a price of 4000 dollars 3 times when it should write the vehicle once. at the same time, a 2017 model ford vehicle is also worth 4000 dollars if I use the code you gave, the price of the 2017 model vehicle will be deleted. what I want to do is to write the price of 2016 and 2017 model vehicles, although their prices are the same, and to prevent extract table data from writing the same data 3 times.

I apologize for my bad English.

Hi @emir_ozsimsir
For that you need to make your datatable should have atleast two columns of with model vehicle other column with dollar values

1 Like

Yes, you are right, it can be solved in this way and I tried it, but extract table data repeats the same way when writing the models, so the models are written in the wrong lines and the prices do not match. I think I need to find a different way.

thanks for the help.

Can you share the sample data which you are getting with full columns

1 Like

@emir_ozsimsir

Can you preview the data in extract datatable and check if they are actually repeated or that is the exact data…

Ideally there wont be any repeatition

Cheers

1 Like

@Anil_G

890000 should come after 960000, but 850000 is written for the second time.

I am trying to get the prices on the second hand car sales site, I save all prices on 14 pages to excel.

here is the website I use
https://www.sahibinden.com/ford-focus-1.6-ti-vct/otomatik?a5_min=2015

this is the excel file I saved
ford.xlsx (16.1 KB)

Hi @emir_ozsimsir
After extracting the data table use Remove Duplicate Rows activity

image

O/P Excel:

ford (1).xlsx (19.2 KB)

I hope you understand!!

1 Like

@emir_ozsimsir

  1. Try getting remainign columns also and check if it is same or may be there is some hidden element in between
  2. If same then can use Remove duplicates activity…but for that would suggest extra as many columns as possible so that only duplicate are removed and after that can use filter datatable to get only the columns you need

cheers

If I use the remove duplicate activity, I will have removed all the vehicles with the same price and the same year, in short, in the photo I threw, the number of vehicles says 272 vehicles, there should be 272 vehicles in the file I saved, in the excel file you threw, all vehicles that do not repeat but have the same year and price are deleted.

https://www.sahibinden.com/ford-focus-1.6-ti-vct/otomatik?a5_min=2015

Hi @emir_ozsimsir ,

What is the Row Count received for the Datatable after using the Remove Duplicate Rows Activity ?

Also, If there are multiple Vehicle Name searches to be performed, would suggest to add the name of the Vehicle also to the Datatable and then Perform the Remove Duplicate Rows activity so that we can maintain the uniqueness of data as required.

Hi @emir_ozsimsir
I have assign the columnname as price and removed duplicates

If not met your need
Let me know

Cheers

1 Like

I can’t figure out what I’m doing wrong.

Datatablevaraible.AsEnumerable.GroupBy(Function(i) i(“columnName”).tostring).Select(Function(g) g.First).CopyToDataTable

Use above mentioned one

You are using the old query

1 Like

the code you gave worked but it found 140 results when it should have found 270 results I want to cry :sob:

you and other users always help me thank you very much :heart:

What you actual expect is not understanding
Other people like @Anil_G

Can definitely help you please make a sample input and expected output so that me or other people will help definitely

Happy to assist you

Cheers

1 Like

The sample file I shared will direct you to the site in the picture. The meaning of the part I underlined in red is 271 results found. In other words, the extract table data activity needs to write 271 prices to excel. numbers ending with tl indicate the price.

In short, the amount of results on the website and the amount of rows written in excel should be the same.
sample.zip (491.9 KB)