I want to concatenate the number of rows which is dynamic i.e sometimes I need to concatenate rows Input :
Column A
item 1
item 2
…
…
item n
in columnA some time the rows will be 2 ,sometime 3 rows , 4 row s etc
I want to concatenate like item1+ “" + item2 if the number of rows is 2
I want to concatenate like item1+ "” + item2+ “" + item3 if the number of rows is 3
I want to concatenate like item1+ "” + item2+ “" + item3+ "” + item4 if the number of rows is 4
etc
but it should concatenate between 3 astrik symbol “***”.
do one thing: respecify your requirements in complete version. Share with us samples and its output descriptions. Use the </> format button from editor, when sharing snippets influencing MD Code from editor e.g. * making italic
code is concatenating dynamic the row/col values maybe you can adapt by following:
(
From i In Enumerable.Range(0, dt_Data.Rows.Count)
Let s = String.Join(" *** ", dt_Data.AsEnumerable.Take(i+1).Select(Function(r) r("Column1").ToString))
Select dt_Data.LoadDataRow({s}, True)
).CopyToDataTable
If A coulmn contains A,B,C,D(row1,row2,row3,row4) then output should be
ABCD
in the same if the input is x,y,z then output should be xy***Z etc
instead of multiple rowsI want to make single row
we do not recommend to reimplement a String.Join. When a non-Linq approach is used, then we would loop over the datatable and construct a list from the column values