I want to replace Nà value with blank one. I am able to replace other text values, since Nà seems to be special symbol it is not getting replaced in data table.
Also if possible want to add multiple replace condition in same linq query.
Please refer below Linq which need to be modified.
(From r In dt_Final.AsEnumerable
Let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.ToLower.Replace(“nà”,“”)).toArray()
Select dt_CSSorted.Rows.Add(ra)).CopyToDataTable()
I believe the Expression should be changed to the below :
(from r in dt.AsEnumerable
let ra = r.ItemArray.Select(Function(x) if(x.ToString.Trim.ToLower.Equals("nà"),"",If(x.ToString.Trim.ToLower.Equals("res"),"yes",x.ToString))).ToArray()
select dt_CSSorted.Rows.Add(ra)).CopyToDataTable
Also Interesting to know that the workflow shared was built in C# but a Vb.net syntax is accepted.
there will be a certain threshold where a resulting LINQ risks to get over-LINQed
One technique could be to work with a LookupDict
Assign Activity: dictLK = new Dictionary(Of String, Object) From {{"res","yes"}, {"nà", ""}}
dtResult =
(From d In dtData.AsEnumerable
Let ra = d.ItemArray.Select(Function (x) If(dictLK.ContainsKey(x.ToString.Trim().toLower()),dictLK(x.ToString.Trim().toLower), x)).ToArray()
Select r= dtResult.Rows.Add(ra)).CopyToDataTable