Concatenate Rows Items into one String

Dears,
I want to Concatenate Column Items into one String, as per the below example:

Input :
Column A
item 1
item 2


item n

Desired Output :
output= “item 1”;“item 2”;“item 3”;…;“item n”

Thanks in Advnace

2 Likes

Fine
hope this expression would help you resolve this
–hope we have the datatable ready with us and say named outdt
str_output = String.Join(“;”,outdt.AsEnumerable().Select(Function(a) a.Field(of string)(“yourcolumnname”)).ToArray())

Cheers @hsendel

8 Likes

Thanks a lot I find similar subject : Convert 3 rows cell data to one cell data - #15 by sarathi125

Great
Cheers @hsendel

But the issue is the command is checking all rows, and I got this error message :


How to limit to only rows with data ?

but may i know what was the expression used and at which activity we are getting this error
Cheers @hsendel

Thanks Palaniyappan. Problem Solved

Here’s the command : String.Join(“;”,dt_Sample1.AsEnumerable().Select(Function(a) a.Field(Of String)(“Name”)).ToArray())

I have added command to count the number of rows with data and use another read range and start from A1 To A+NbRows.ToString

dt_Sample.Rows.OfType(Of DataRow).Where(Function(r As DataRow) String.IsNullOrWhiteSpace(String.Concat(r.ItemArray).ToString) = False).Count

Fantastic
thats what suggested i hope

and this was added new to this case
no worries issue got resolved

Cheers @hsendel

1 Like

My target scope not achieved, because the aim of this , is to have an array to put it in “input dialogue” but it’s not working :crying_cat_face:

Fine
what was the issue you were facing
Cheers @hsendel

I want to have rows of one column as array in my “input dialogue”

i hope that this expression would work
what was the output that came up and what is the output actually required
Cheers @hsendel

This will generate only a concatenated items separated by";", but it can’t be used as input in options of input dialogue

Please refer also I have created another subject : How to use items in column as array for "input dialogue"? - #6 by Dave

sure let me reproduce once the process
Cheers @hsendel

1 Like

here you go
kindly try this and let know for any queries or clarification
hsendel.zip (22.6 KB)

kindly correct me if i m wrong with the question
Cheers @hsendel

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.