I have to eliminate .x from any string.
Input - 120.asf.x
12.kiytr.uf90.x
jgui.22980.gtd.x
Required output
120.asf
12.kiytr.uf90
jgui.22980.gtd
Can anyone please help me with a linq query as I have 74k data in excel and using foor loop is very time consuming
Sorry @hasib08 , I need linq query as we are not allowed to use invoke code activity
@hasib08
Tried with dt = dt.AsEnumerable().Where(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Replace(“your old value”,” your new value”).ToString).CopyToDatatable()
but here my input column and output column is different
Yoichi
(Yoichi)
January 5, 2022, 1:50pm
6
Hi,
Can you try the following expression, for example?
dt = dt.AsEnumerable().Select(Function(r) dt.Clone.LoadDataRow({r("Column1").ToString.Replace(".x",""),r("Column2")},False)).CopyToDataTable()
Sequence1.xaml (7.0 KB)
Note : We need to modify arguments of LoadDataRow for actual datatable.
Regards,
Yoichi:
dt = dt.AsEnumerable().Select(Function(r) dt.Clone.LoadDataRow({r("Column1").ToString.Replace(".x",""),r("Column2")},False)).CopyToDataTable()
Hello @Shilpa_Mohanty , I am getting the below error:
postwick
(Paul Ostwick)
September 6, 2022, 12:24pm
9
LINQ isn’t faster than For Each. LINQ still loops, it’s just hidden from you. It’s impossible for data in a table to be updated without looping.