Implementing From For Each Row in Data Table code To Linq

Hi guys,

i want to implement from for each row in data table to linq query but i do not know how? i copied and pasted the code but it didn’t work. so i need help.

This picture is in for each row and i want to implement this code to linq(VB)

This is my linq code(in assign) i implemented no error occured but not doing own job :


Hey @yigit.aybey

Could you please explain the reason for the same?


xPrice does not work when program runs this error happens => Conversion from string “75.000.000 TL” to type ‘Integer’ is not valid. but i xPrice should erase the dots and TL.
On the other hand in for each in assign Prices it fixes this problem but if write to assign activity code doesn’t work. where should i write in invoke code or what should i do.
if u need more explanation i can explain.


1 Like

Yes please.

I have 2 assign activity which one is in the for each loop, another one is outside of the loop you can see in the picture below.

in the for each loop assign activity works perfectly and it is doing erasing TL and dot. It shouldn’t be like this:

my assign activity(in the for each loop) doing 75000000.

My second assign activity does this ; gets the datas from excel separate different datas, summing it and getting avg but right now without Convert.ToInt32(CurrentRow.Item("Fiyat").ToString.Replace(".","").Replace(".","").Replace("TL","")) this code does not work. i mean i wrote this code inside of the second assign activity but when i run the program, the program gets me an error.

so, i hope, i can explained my self better or not. if not what should i write or explain to you understand better? What do you need?


You don’t need LINQ to fix this.



1 Like

It’s not just about 7.500.000 this is just one of them
here is my excel file

there is more than data it looks. i mean i have more than 200 datas. i need to separate depends on the “Semt / Mahalle” and summing the “Fiyat” and finally i need the get the avg of each “Semt/Mahalle” datas. i mean in this pic you can see 2 “Kandilli” and i need to sum ‘Fiyat’ for this picture it is 82.800.800 and get avg after all. This is the aim. But i’m doing in the 3rd picture which i shared at the beggining of the subject.

But before summing or getting avg that, i need to erase TL and dots. Your myInt is ok but i need to implement that code to my linq code (3rd picture).
I hope so far it is ok. Unless it is clear then i can explain step by step.

NOT : I can convert to English version of my columns headers If you like, to being for more understandable.


Just replace your Convert expression with what I gave you, and replace myStr with your CurrentItem row reference.

This is what you said right?

feel free to decompose the LINQ to essential activities for analysis and tracing purpose

From row in Excel_Datas (asEnumerable() is missing within the LINQ)
we can use a for each row

All Lets are mapped to Assign Activities

A group by we can handle as done here:

Taken from: [HowTo] Overview on different options for grouping data and processing the groups

we take the distinct values with the DefaulView.ToTable approach and using it filtering

Select DatatableVar.Rows.Add → add Datarow Activity