Collection all rows data Move everything onto one single line with comma separator
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-09-18 03:09 PM
Hi Team,
I have data in collection, Collection all rows data Move everything onto one single line with comma separator. please find below attachment.
Please share your ideas .Thanks in advance.
Thanks
Murali Mohan
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-09-18 04:29 PM
Loop over collection and concatenate (with calculate stage).
If this obvious solution doesn't work for you - explain why.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-09-18 09:54 AM
There is a default Utility - Strings VBO object in BluePrism. Use the 'Join Text' function to concatenate all values in a collection into a string.
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-09-18 08:57 PM
Hi there Bellaksl,
You should be able to achieve this relatively easily with a code stage.
Incorporate something similar to the below, using an incoming DataTable (your collection) and outgoing String (your comma separated text value):
[Outgoing Comma Separated String] = String.Empty
Dim intCounter As Int32 = 0
While intCounter < [Incoming DataTable].Rows.Count
If intCounter > 0 Then
[Outgoing Comma Separated String] += "", ""
End If
[Outgoing Comma Separated String] += String.Join("", "", [Incoming DataTable].Rows(intCounter).ItemArray)
intCounter += 1
End While
The above will:
Set our outgoing String to nothing
Initialise our counter to 0
Iterate through each row in our incoming DataTable
If we are not on the first row, add a comma, otherwise continue
Add each DataRow value to our outgoing String with a comma separating
Increment our counter
End iteration
You can see it running via this link.
Keep in mind the majority of this is constructing a DataTable, which you will not require!
ALSO, there is no validation or handling included - most likely, you will want to validate the incoming DataTable is initialised and populated accordingly.
Thanks in advance and good luck,
Josh
