I attempted to follow the link to replace some values in one specific column in my dataset. The error message, however, popped up “Option Strict On disallows implicit conversions from ‘String’ to ‘Boolean’”.
The LINQ I used in Assign Activity is…
dt_Combined.AsEnumerable().Where(Function(a) a.Field(of string)(“PhoneNo”).ToString.Replace(“-”, ””).ToString).CopyToDatatable()
Would be greatly helpful to advise me what triggers the error message…
unfortunately we cannot refer to your sample data.
The issue could occur from following:
the where method expects an evaluation function (predicate, lambda function) that is returning a boolean
currently in the the where block a string is returned from the replace method.
give a try on:
Assign activity:
leftside: dtCorrected (DataType: DataTable)
right side: t_Combined.Clone()
assign activity:
left side dtCorrected (datatype: Datatable)
rigth side:
(From d in t_Combined.AsEnumerable()
let ra = d.ItemArray.Select(Function (x) x.toString.Replace(“-”, ””)).toArray
Select rc = dtCorrected .Rows.Add(ra)).CopyToDataTable
Thank you for replying. The original data (highly confidential) is consisted of some columns such as “PhoneNo”, “Postal Code” which sometimes contains “-”, sometimes not (for instance, 1112223333 or 123-456-7890 or 2223334444). And to join with other DataTable which doesn’t have any “-”, I would need to remove all “-” from those columns.
While following the instruction, my DataTable got a same value for all the rows like the screenshot attached to this…
Thank you for answering. Actually this worked well! Just wondering if there’re multiple columns to which I should apply the same logic, am I supposed to duplicate and coy same lines? Or any beautiful way to write…?
(From d In dt_Combined.AsEnumerable()
Let ra = d.ItemArray.Select(Function (x) x.ToString.Replace(“-”,“”).ToArray)
Select rc = dt_Corrected.Rows.Add(ra)).CopytoDataTable
Hi, this works fine!
(From d in dt_Combined.AsEnumerable()
let ra = d.ItemArray.Select(Function (x) x.toString.Replace(“-”, ””)).toArray
Select rc = dtCorrected .Rows.Add(ra)).CopyToDataTable
But I need Replace Just in the Column (“Time”) from Dt
any Idea?
Thanks