This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Hello,
is there a way to add a continous count or number as a prefix to the column titles?
I did not find a solution with the dynamic rename tool.
I hope someone can help me out, below is an example 🙂
Input:
Category | Banana | Apple | Kiwi | Cucumber | Orange |
Weight | light | light | light | light | light |
Color | yellow | red | brown | green | orange |
Output:
01Category | 02Banana | 03Apple | 04Kiwi | 05Cucumber | 06Orange |
Weight | light | light | light | light | light |
Color | yellow | red | brown | green | orange |
Solved! Go to Solution.
You can transpose the column names and add a record ID and combine them. I made a condition that if the Record ID was between 1-9, it'll add a 0 in front of it.
Then cross-tab them and rename. I've used a dynamic rename as the cross-tab will convert special characters and spaces to underscores. Using the record ID as the header name in the cross-tab and changing it in the dynamic rename will means that you'll always have the original header name with the number as the prefix.
EDIT: Didn't realise there was more than 1 row. I just added the select records (could've used Sample tool grabbing the first row and the other skipping the first row) so that the first row can be used to transpose/cross-tab and then rest of the data is unioned at the end.
You can also use the field info tool so that you don't have to split the data or use the transpose.
I've attached a workflow of both
Hi @Czaggy
Both of the previous solutions are good but using Transpose or Crosstab tools can be very expensive if you have lots of data in your table. Here's a solutions that avoids those, using a minimal number of tools
Start with the Field Info tool to extract the list of column names in the order that they appear. Add a record ID which is then prepended to the field name. The Dynamic Rename tool takes the fields from the original input and renames them using the new names from R input.
Dan