Convert multiple rows to single row in collection

Hi,

I have two collections with below structures:
collection-1
No. of rows = 20
No. of columns = 1

Collection-2
No. of rows = 2
No. of columns = 10

my task is to move the data from collection-1 to collection-2 where the first 10 rows of collection-1 should be populated in first in 1st row in collection-2, second 10 rows of collection-1 should be populated in 2nd row in collection-2.

Any thoughts on doing this task using loops/counters instead of doing in by manually hard coding the row/field names.
 

dallangoldblatt

New Member
Unfortunately, Blue Prism does not have the capability to reference Collection values using index numbers. If you wanted to do this without hard coding the row/field names, you would have to pass collection-1 to a Business Object with a code stage where you can implement it using VB or C.
 

VJR

Well-Known Member
Hi Highspirits,

Name: Collection1
Column1
Row1-
.
.
Row10-
.
.
Row20-

Name: Collection2
Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 | Column8 | Column9 | Column10
Row1-
Row2-


There are 10 columns in Collection 2. In which column of Collection2 is the Collection1 rows to be pasted?
Looks like you mean every single row of Collection1 should go into a column of Collection2?

Name: Collection1
Column1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

should become as -
Name: Collection2
Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 | Column8 | Column9 | Column10
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20


Also what do you mean by "instead of doing in by manually hard coding the row/field names"
What is the information you are currently having in the diagram about the 2 collections and their field names?
 
Last edited:
Hi Highspirits,

Name: Collection1
Column1
Row1-
.
.
Row10-
.
.
Row20-

Name: Collection2
Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 | Column8 | Column9 | Column10
Row1-
Row2-


There are 10 columns in Collection 2. In which column of Collection2 is the Collection1 rows to be pasted?
Looks like you mean every single row of Collection1 should go into a column of Collection2?

Name: Collection1
Column1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

should become as -
Name: Collection2
Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 | Column8 | Column9 | Column10
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20


Also what do you mean by "instead of doing in by manually hard coding the row/field names"

What is the information you are currently having in the diagram about the 2 collections and their field names?

--> Yes, the way you represented the data and the collections is what I wanted to achieve.
--> by manually, I meant without using specific column names and instead using some kind of indexing/looping logic.
--> the information is alpha-numeric (can be either text/number).

Please let me know if you are looking for any other information on this.
 
Unfortunately, Blue Prism does not have the capability to reference Collection values using index numbers. If you wanted to do this without hard coding the row/field names, you would have to pass collection-1 to a Business Object with a code stage where you can implement it using VB or C.
Thank you for the reply. I was also thinking the same.
 

VJR

Well-Known Member
--> Yes, the way you represented the data and the collections is what I wanted to achieve.
--> by manually, I meant without using specific column names and instead using some kind of indexing/looping logic.
--> the information is alpha-numeric (can be either text/number).

Please let me know if you are looking for any other information on this.
Hi Highspirits,

by manually, I meant without using specific column names and instead using some kind of indexing/looping logic.
Yes you can do this even if you are unaware of the column names by making use of the 'Get Collection Fields' action.
It is explained in the below link. Do post back if you are having any doubts.
http://rpaforum.net/threads/loop-th...tion-without-using-column-name.1196/post-3688

If you have lots of data and are concerned with looping and slow speed then using the Code stage would be a good option.
 

anisjolly

Administrator
If you have lots of data and are concerned with looping and slow speed then using the Code stage would be a good option.

A word of warning though, if you do use a code stage, please make sure there are other developers on your team that are able to support it going forward. It is advisable to avoid code stages where a key man dependency occurs.
 
Hi Highspirits,

by manually, I meant without using specific column names and instead using some kind of indexing/looping logic.
Yes you can do this even if you are unaware of the column names by making use of the 'Get Collection Fields' action.
It is explained in the below link. Do post back if you are having any doubts.
http://rpaforum.net/threads/loop-th...tion-without-using-column-name.1196/post-3688

If you have lots of data and are concerned with looping and slow speed then using the Code stage would be a good option.
Thanks for this VJR. That helps!
 
Top