Manipulation in Extracted DataTable



Hi there

I managed to extract table from the webpage and returned as DataTable data type.

I found very difficult to manipulate this in “Invoke Code” as I have very complex in CSharp:

var res = dataTable.AsEnumerable()
.Select(r => new {
Id = r.Field(“Id”)
, Hits = r.Field(“Hits”)
, Date = r.Field(“Date”) // Use proper type here
.GroupBy(r => r.Date)
.Select(g => new {
Id = g.OrderByDescending(r => r.Hits).First().Id
, Date = g.Key

Obviously need to convert in VB.NET

Couple question:
Is there any sample to work in returning datatable in Invoke Code by any chance?
In Assign, if we got complex Linq can we returned back DataTable? I found this is not possible.

Compare 2 column values and delete identical rows through LINQ

IJust got a chance to check this, you may try below way, if not using Invoke Code.

Don’t have experience with Invoke Code, but you could do the similar way. You could use CopyToDataTable for Ienumerable DataRow to convert your linq to DataTable, but this query returns Ienumerable anonymoys type, so I had to convert to dictionary and later convert into a datatable. May be there is a better solution.

linq.xaml (8.5 KB)


To handle this IEnumerable anonymous type, how do I handle in the future if I need to return more than 2 column then?


One way is

Don’t use the Dictionary extension, assign the output to
IEnumerable Object(say result)

Build a data table (dtOut) with columns

Iterate the result using foreach

For each item in result

rowArray = split(item.ToString,",") (update: I guess you need to remove the paranthesis as well here ({ })


Add data row activity.

pass rowArray into ARRAY ITEM property.

dtOut to Datatable property

End foreach