Apply the same method to the entire datatable column

Hello everybody,
I’m doing an automation where I read a csv file with information about the customer’s order. Inside the csv I have a quantity column that has many zeros after the comma (Ex: 300,00000) I need to ignore all the values after the comma and get the real value (Ex: 300). I know, one can use the for each row, apply the split method, and assign the new value, but I find this process so inefficient (when running the program in debug mode), plus I already have many for each in the workflow.
So is there an efficient method, maybe in an activity or line of code that could apply the same treatment to an entire column?

Hi @Sebastian_David_Jime

U can try invoke code with dt1 as In/Out argument

dt1.AsEnumerable().ToList().ForEach(Sub(row) row(columnname)= Split(row(columnname).ToString,“,”)(0))

Regards,

Nived N

Happy Automation

2 Likes

It works perfectly, thank you so much
For related workflows and a better understanding of the solution. If I need to do another treatment, I’ll just change the right side of the equals sign, right?

Yes @Sebastian_David_Jime

Please mark it as solution if it helps you

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.