(From r In dtTempFilter.AsEnumerable Select ia = r(0).ToString.trim.Replace(" Total",“”) )
The above one gives an array of strings, I donno how to convert to datatable
(From r In dtFilterTable.AsEnumerable Select ia = r.ItemArray.toList Select ic = ia.ConvertAll(Function (e) e.ToString.Trim.Replace(" Total",“”)).toArray() Select dtResult.Rows.Add(ic)).CopyToDataTable()
The above one changes all ‘Total’ values into “” including last column.
Please help me with the suitable one.
Please refer the image.
for learning purpose A LINQ within the datatable reconstruction approach would look like:
dtResult = dtData.Clone
dtResult =
(From d in dtData.AsEnumerable
let c1 = d(0).toString.Replace(" Total",""))
Let ra = d.ItemArray.Skip(1).Prepend(c1).toArray
Select r = dt.Result.Rows.Add(ra)).CopyToDataTable
(From d In DtBuild.AsEnumerable()
Let ra = d.ItemArray.Select(Function (x) x.toString.Replace("Total","")).toArray
Select rc = DtOut.Rows.Add(ra)).CopyToDataTable
For learning purpose and explore the different options to update a column value have a look here:
And fo LINQ here:
this statement is replacing in all columns as it is driven by the itemArray and is similar to
(From d In DtBuild.AsEnumerable()
Let ra = d.ItemArray.Select(Function (x) x.toString.Replace("Total","")).toArray
Select rc = DtOut.Rows.Add(ra)).CopyToDataTable
Hi @Sunil_Kumar_Marri1
please follow these steps.
1- read data through read range and stored in DT1
2- Use for each over datatable
3-Use * Assign Activity: row(“Col1”) = Spilt(ow(“Col1”).toString,“ ”)(0)
It is worked on first column, but what if that column in middle and one more thing
(From d in dtData.AsEnumerable
let c1 = d(0).toString.Replace(“”,“Mapping Not Found”))
Let ra = d.ItemArray.Skip(1).Prepend(c1).toArray
Select r = dt.Result.Rows.Add(ra)).CopyToDataTable
I’m doing this for empty row replace with “Mapping Not Found”,but gets an error.
It would be helpful for my project.
Please help me with this.
Here, we skip the first column and prepend our manipulated data, I asked this.
Please help if u know about it.
And
Check this too…
(From d in dtData.AsEnumerable
let c1 = d(0).toString.Replace(“”,“Mapping Not Found”))
Let ra = d.ItemArray.Skip(1).Prepend(c1).toArray
Select r = dt.Result.Rows.Add(ra)).CopyToDataTable