Hello everyone,
I am new on alteryx and I would like to create a workflow which reorders the columns regardless of the input file order.
if the input of the workflow corresponds to File 1 or File 2 the output should be the same
example :
Input File 1: E A B D C
Input File 2:B D E A C
Output file should be : A B C D E
Thank you in advance for your help
Solved! Go to Solution.
Hi @NadaH ,
Would sorting headers alphabetically be a solution? If so, there is a "Sort Fields" tool in the CReW Macros pack which would be an easy one-tool fix. If not alphabetic, there are some other creative ways to define order.
For the CReW macros, you can download and install those tools in just a minute here:
Thank you for your answer @NickSm ,
No, in my case the order of my columns should not be done alphabetically.
Can you give me some hints in this case?
Thanks
If both file inputs were fixed, you can use a Select Tool and click on the name of the field to auto-sort. This will provide a one-time sort in either ascending or descending order and will at least minimize the clicking of the up-down arrow to do it manually. If your inputs will vary, I second NickSm's response about using the Sort Fields tool for simplicity.
Hi @NadaH ,
I've attached a workflow that does this for you.
As you can see, I've created a file that determines the order of the columns. I then transpose the data, assign this order as a number, sort by that number, then crosstab back so the data is back in the original format but with the column in the correct order.
I hope this helps,
M.
@mceleavey Thank you