Convert the collection rows into column
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-09-22 05:41 PM
I have a collection which actually i got when i got a table in email in HTML format and converted into plain text, currently the collection has only 1 row eg
Current format
row1
row 2
row 3
row 4
A
b
c
d
1
2
3
4
Expected format
row 1 row2 row 3 row4
A b c d
1 2 3 4
basically the data's in single row collection has to be split into different columns
Thank You
------------------------------
Miya
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-09-22 07:38 PM
You can use the 'Transpose Vector Into Collection' action of the Collection manipulation utility.
If you don't have access to the utility I put a link to it at the end.
To use this action, just pass your collection that has only one column and then pass a collection containing only the columns you want to form.
https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---collection-manipulation
Hope this helps, if you still have any questions let me know.
------------------------------
Lucas Silva
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-09-22 09:02 PM
I am not able to get the transpose vector into collection action after importing the object from the link you provided, can you double check the link, because when i open the document attached to the utility collection manipulation it shows only transpose action,i am npt able to see the transpose vector into collection or is this object has version compatibility iam using bp v 6.8
------------------------------
Miya
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-09-22 09:31 PM
For that, you must create a new page inside the utility and add the following code blocks.
Input
Code
Output
Inside the code block
Input
Code
Code to paste:
If ((collection.Rows.Count Mod columns.Columns.Count) <> 0) Then
Throw New ApplicationException("The supplied collection doesn't have the right size")
End If
If ((collection.Columns.Count) <> 1) Then
Throw New ApplicationException("The supplied collection doesn't have the right size")
End If
result = New DataTable()
For Each c As DataColumn in columns.Columns
result.Columns.Add(c.ColumnName, c.DataType)
Next
dim j as integer = 0
Dim newRow As DataRow
For c As Integer = 0 To collection.Rows.Count - 1
if (j Mod result.Columns.Count = 0) then
j = 0
newRow = result.NewRow()
end if
if(c < result.Columns.Count) then
newRow(c) = collection.Rows(c)(0)
else
j = c Mod result.Columns.Count
newRow(j) = collection.Rows(c)(0)
end if
if (j Mod result.Columns.Count = 0) then
result.Rows.Add(newRow)
end if
j = j + 1
Next
When finalizing and checking the code, if an error appears, check that on your Initialise Page there are all the necessary libraries as shown below:
1)
2)
#BPTechTips
------------------------------
Lucas Silva
RPA Developer
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-02-23 08:34 AM
Hi Lucas,
I am trying your code right now but received this code error. I've checked the Initialise page libraries and there is nothing wrong there, exactly the same as yours. Any idea how to resolve?
------------------------------
Nafiz Zainal
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-02-23 10:36 AM
Hi Nafiz,
result must be declared as an output parameter of your codestage. Have you done that?
Best,
Michael
------------------------------
Michael Wulf
Senior Developer Robotic Process Automation
e.kundenservice NETZ GmbH
Europe/Hamburg
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-08-23 07:55 AM
Hi,
I got the data from Notepad into Collections but it came in one row. Now, I want to have this data into different columns.
Division# Contract#/ Name Address Type Change Field Address-Old ? all this came in one single column in a Collection, I want them in separate columns.
Please help me how to do it.
------------------------------
Mohammed Abdul Shakeel
------------------------------
![](/skins/images/9189B71481660F69BDFE7B81213488A9/responsive_peak/images/icon_anonymous_message.png)