Automatically make .trim () on a datatable in all rows and columns

Hello,

first excuse me for english, i have a datatable with more than 100k lines and needed to do .trim () on all rows and columns and if doing foreachrow takes too long, is there a faster and automated way?

Thanks in advance.

have a look here:

in your case:
(From r In dtData.AsEnumerable
Select ia = r.ItemArray.toList
Select ic = ia.ConvertAll(Function (e) e.ToString.Trim()).toArray()
Select dtCorrected.Rows.Add(ic)).CopyToDataTable()

or

(From r In dtData.AsEnumerable
Select rac = r.ItemArray.Select(Function (x) x.toString.Trim).toArray
Select dtCorrected.Rows.Add(rac)).CopyToDataTable()

4 Likes

Can you use foreach or foreachparallel to cycle through this Enumerable?

it is used within an assign activity and is not used in a combination with a for each xxx activity

image
image

Error: Assign - Qty of columns table: Object reference not defined for an instance of an object.

tabelaassociados = My DataTable

did I do something wrong or is something missing from what you gave me? thanks in advance.

had you prepared the empty dtCorrected Datatable?

I just declared it, do I have to do anything more? Iā€™m new to UiPath sorry for ignorance

@joao_adelio1
Yes the column structure has to be the same as fro the original datatable.

One option to do it:
Assign Activity:
left side: dtCorrected
right side: tabelaassociados .Clone()

it worked, thanks!

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