cancel
Showing results for 
Search instead for 
Did you mean: 

Set New Collection Columns from First Row of Existing Collection

nrenaud1
Level 4

I need to set the column names of a new empty collection to the first Column of another collection.

The data will always be dynamic so there is no way of knowing how many columns I will need to create.

Is there a way to set Column Names in new collection by the all the values of the first Column?

 Or at least take this first column and set it as a the first row in a new collection ?

Thanks



------------------------------
Nick R
Developer
------------------------------
1 BEST ANSWER

Helpful Answers

Hi @Sonam Sharma I need every row from Column1 (which has about 165 rows - it will always be dynamic though)  to be the Column headers of new collection, or the First Row.

UPDATE: easy fix, as I was looping through the rows manipulating original column headers,  Append Field to new Collection using my new values.

------------------------------
Nick R
Developer
------------------------------

View answer in original post

4 REPLIES 4

LakshmiNarayan3
Level 6

Hi Nick

You have both options available in Utility Collection manipulation VBO , Please go through it.

Regards

Lakshmi Narayana



------------------------------
Lakshmi Narayana
------------------------------

sonsharm
Staff
Staff

Hi @Nick R ! You can follow below steps by leveraging Utility - Collection Manipulation :

  1. Read first column data of existing collection using filter collection action or calc stage.
  2. Append data to the new empty collection using "Transpose collection" action.
  3. Invoke "set first row as column" action,



------------------------------
Sonam Sharma

SS&C
------------------------------

Sonam Sharma Manager, Blue Prism SS&C

Hi @Sonam Sharma I need every row from Column1 (which has about 165 rows - it will always be dynamic though)  to be the Column headers of new collection, or the First Row.

UPDATE: easy fix, as I was looping through the rows manipulating original column headers,  Append Field to new Collection using my new values.

------------------------------
Nick R
Developer
------------------------------

Hi Nick,

Do like this:

  • Read only Column1 into an undefined Collection1
  • Loop Collection1
    • For each row:
      Add a new column to undefined Collection2 with column name being the value from the current Collection1 row
  • You'll end up with Collection2 having as many columns as Collection1 had rows, Each column header in Collection2 will have column name as specified in Column1 of Collection1
  • Ready


------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)