How to get the values of a data column to a string.
Column1 Column2
ab er
cd er
ef er
I want the the values of the column ‘Column1’, So that my output looks like “ab,cd,ef”
Thanks in advance.
How to get the values of a data column to a string.
Column1 Column2
ab er
cd er
ef er
I want the the values of the column ‘Column1’, So that my output looks like “ab,cd,ef”
Thanks in advance.
May be there is a easy way @MariaJosephina,
But this will also work.
Here are some steps
@MariaJosephina
You can get value from table like
Table1.(rowindex).item(columnindex).tostring
Or
Iterates datatable through for each activity
Rowitem.item(columnindex). tostring
Thanks
I need without for each iterattion
Then
Table1.(rowindex).item(columnindex).tostring
Like
Table1.(0).item(0).tostring ,Table1.(1).item(0).tostring …so on
Do onething,
Filter the datatable like, keep only the required column in the existing datatable using Filter Data Table activity and store in a new data table
then, use Output Data Table activity which will return you the data table in a string @MariaJosephina
The Classical Way:
Iterate with for each row and add first column to a collection of type List(Of String)
The one liner
define a variable: eg. name: StringListVariable type: List(Of String)
Use an assign activity
To: sl,
Value: YourDataTableVariable.AsEnumerable.Select(Function (row) row.Field(Of String)(“YourColName”)).toList
Later you can easy bring the string list to flatten string eg. String.Join(“,”,StringListVariable.ToArray)
For the one liner way make sure System.Data.DataSetExtensions is imported
Have a look here:
Thanks it worked
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.