Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Maintain order of columns after a dynamic rename

jjoerger
7 - Meteor

I am looking to maintain the order of columns after a dynamic rename.  I believe designer thinks the columns are new and throws them to the end of the list.  I need the columns to be in a specific order prior to output.  The columns will not always be the same values.  they are dependent on user input.  In my picture, Columns M-O need to come before C-G and P-R need to come before H-L.

Column Order (incorrect).PNG

As you can see in my join, I have a specific order.  A rename for Year One Rate, Year Two Rate and Year Three rate put the columns down to the right after the columns H-L

Join.PNG

Below the join marked with a red x is the join above.  The dynamic rename is an attempt to rename the generic columns with more meaningful names including dates from user input.  However, at the end, all the columns for Rate need to stay together and the columns for Circ need to stay together etc.  After all the rate and circ I'm appending spend and the same issue piles onto the other.  Any assistance would be greatly appreciated.

Canvas.PNG

3 REPLIES 3
CharlieS
17 - Castor
17 - Castor

I don't have a better suggestion other than to share my method. In situations like this I'll create/rename the fields at the beginning with values that will sort and maintain order. You can even us a Field Info Tool, Record ID, then Dynamic Rename with those Record ID values. When all the data prep is finished, I'll keep that same data stream of original names and Record ID values and use another Dynamic Rename to revert the names as the very last step. 

Qiu
20 - Arcturus
20 - Arcturus

@jjoerger 
Here is what I usually do for this situation.

The Cross Tab will force the columns by an assending order, so take the advantage by adding numbers.

if your columns are more than 10, try to make the prefix to be 2 digits.

CaptureV1.PNG

danilang
19 - Altair
19 - Altair

Hi @jjoerger 

 

The Dynamic Rename tool doesn't reorder columns.  It will only rename existing ones according the config that you set up.  You can check this by comparing the data values in the first row of the input to the Dynamic Rename tool with the data in the output.  Any reordering that you see is more likely to be caused by the 2 Join tools that you have before it.  If you have dynamic columns, such columns that vary by week, these will be placed wherever the *Unknown column is in the config.  This is usually last but you can place it any where and that's where the dynamic columns will appear

 

danilang_0-1614709870804.png

 

 In the example above, any dynamic columns will always appear after the ID column 

 

Dan 

Labels