I need to append two rows in datatable and store it in single variable
For eg: date value count
12/31/2020 14 3
12/31/2021 13 2
Output should be 12/31/2020 14 3;12/31/2021 13 2 should be stored in string variable
I need to append two rows in datatable and store it in single variable
For eg: date value count
12/31/2020 14 3
12/31/2021 13 2
Output should be 12/31/2020 14 3;12/31/2021 13 2 should be stored in string variable
You can get the row in an array using an item array and using string.join you can join two arrays in a single variable.
Hi
Hope these steps would help you resolve this
βif the data is in a datatable named dt then use a output datatable activity where pass the dt as input and get the output as string variable named str_output
βthen use a assign activity like this
str_final = String.Join(β;β,Split(str_output,Environment.Newline.ToCharArray)).ToString
Cheers @sruthesanju
Hi @sruthesanju
Letβs say the rows are in index 0 and 1 (row index)
Then use,
String.Join(" β,dt1.Rows(0).ItemArray())+β ; β+
String.Join(β ",dt1.Rows(1).ItemArray())
Regards,
Nived N
It considering the header also
I get the out as
Date value count;12/31/2020/ 13 4
In that case use the below expression to remove the header
str_final = String.Join(β;β,Split(str_output,Environment.Newline.ToCharArray).Skip(1).ToArray()).ToString
Cheers @sruthesanju
String.Join(";", {0,1}.Select(Function (x) String.Join(" ",dtData.Rows(x).ItemArray)))
within array you can mark the row index of all rows of interest
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.