Hi All ,
i have a datatable where one particular column is having value as "INR 129.00", here i want to remove the INR without using For Each command...pls help me on this any possibilities using LINQ
Hi All ,
i have a datatable where one particular column is having value as "INR 129.00", here i want to remove the INR without using For Each command...pls help me on this any possibilities using LINQ
Hi @fayaz
do one use for each row in datatable
Assign strvar=row(“Value”).ToString
StrArray=strvar.ToString.Split(“INR”.ToCharArray).
Thanks
Ashwin S
Thanks @AshwinS2 , Yes it should work in for each…i was thinking any possibilities without using it and can achieve it with LINQ…
Try below Linq query.
newDT = datatable.AsEnumerable().Where(Function(row) row("ColumnName").ToString.Replace("INR", "")) .CopyToDataTable
@lakshman Thanks bro, i am facing compilation error as follow " [Getting the error as - option strict on disallows implicit conversions from ‘string’ to ‘boolean’] "…any idea bro?
Sorry… Its my bad. Try below one:
DataRow [] newValues = datatable.AsEnumerable().Select(Function(row) row("ColumnName").ToString.Replace("INR ", "")).ToArray
Hi,
How to remove multiple columns in datatable using linq?
@SARITHA_Masani
Can you Open for your question a new topic as IT differs from Origin older Threads topic. Thanks
Hi @lakshman, I am getting the same error, I don’t understand the new code.
can you help? Thanks
Can you please share screenshot of your Input data and expression you are using here. So that I can check and help you better.
This is my data, I need to remove the $.
I use this code
dt1.AsEnumerable().Select(Function(row) row(“Name”).ToString.Replace(“$”, “”)).ToArray
but I got the error as - 'option strict on disallows implicit conversions from ‘string’ to ‘boolean’
@lakshman Hi, it is clear?
Try below expression.
newDT = dt1.Clone
newDT = (From r In dt1.AsEnumerable let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.Replace("$",“”)).toArray() Select newDT.Rows.Add(ra)).CopyToDataTable()
Write above two lines into two different Assign activities and create one new variable named newDT of type DataTable.
Thank you @lakshman