Hello,
I'm trying to rename the headers on a collection. My goal is to do perform some calculations on the various rows, but since the headers on main collection are dynamic, I need to simplify the header naming in order to perform the calculations.
Inputs: Main Collection, New Headers
Output: Renamed Collection
Let's say I have "Main Collection" with the following structure:
Column1 | Column2
------------------------
Jason | 34
Instead of using the names Column1 and Column2, I would like to rename the headers to Name and Age. With the Collection Manipulation VBO, I can easily do that by using "Rename Headers" action. This requires me to create a new collection with the same headers, and a row with the new the name of new headers under their corresponding fields.
Example of "New Headers" collection:
Column1 | Column2
------------------------
Name | Age
Example of expected output (Renamed Collection):
Name | Age
---------------
Jason | 34
However, this is where my challenge occurs: My columns headers will be dynamic, because they will contain a date. This date will change every day. Basically, I won't know what my headers will be named the next day. So creating the "New header" collection is a big challenge. Also, after performing the calculations, I'd like to revert the column headers.
I found the action "Get Collection Fields", which retrieves the headers from "Main Collection" to a new collection, like "Collection Fields". I was thinking about looping through that collection, and add the rows as a field using the action "Append Field (Text)". This does not work however, because the collection I want to append to cannot be empty.
I think it would be easy to rename headers programming wise, but I'm not familiar with the code block, and how to use it.
Do you have any ideas on how I can solve this problem by using BP actions/stages?