Can you please tell me how to replace commas with periods in a column using a LINQ query?
For example, there is a column “Column1” in it numbers of the format “12334,12”, as with the help of LINQ query replace with “12334.12”.
An example of my requests:
assign dt = dt.AsEnumerable (). Where (Function (a) a.Field (of string) (“Column1”). ToString.Replace (“,”, ”.”). ToString) .CopyToDatatable () - option error strict on disallows implicit conversions from ‘string’ to ‘boolean’.
assing dt = dt.AsEnumerable (). ToList (). ForEach (Sub (row) row (“Column1”) = row (“Column1”). ToString.Replace (",", “.”)) - error expression does not produce a value.
Please try below steps,
Read the excel sheet data in the datatable variable name dt.
Drag and drop the invoke code activity.
In edit arguments, create a variable dt, set direction as in/out and pass value as dt.
In edit code type the following,
dt.asenumerable.tolist.foreach(sub(row) row(“Column1”)= row(“Column1”).tostring.replace(",","."))
Write the datatable back into the excel using write range activity.
We have to use this inside invoke code as it does not produce a output.
Hope this helps.
Did u tried this
dt.AsEnumerable().ToList.foreach(Sub(row) row("Column1")= row("Column1").tostring.replace(",","."))
@sereganator I can’t open the file in my laptop due to restrictions can you please share some screenshots of the workflow.
Yes, tried this, but error.
Make sure the datatable has been passed in the invoke code correctly, make sure the column name matches with the excel.
Else try this also
dt.asenumerable.tolist.foreach(sub(row) row(0)= row(0).tostring.replace(",","."))
Have you passed the output of read range in value of invoke code argument?
It seems empty.
Have you enter dt in this field.
I apologize for the inattentiveness, I really did not convey it. Thanks.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.