Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

how can i preserve the column orders when dynamically updating the data types?

Mond
8 - Asteroid

I have a workflow that i am creating that needs to 1) pivot the original data, 2) set the column orders for pivoted data, and 3) adjust the data types for specific types of data columns. i have been able to do this for the most part, except for the last part where after i update the data types and rejoin the data, the column orders get messed up. I need this workflow to be dynamic since the input data may change depending on what type of data is used for the workflow, so i cannot simply set the columns as i want and call it a day... could i get some advice on how i can achieve this? 

4 REPLIES 4
binuacs
21 - Polaris

@Mond add a union tool then set the specific output order

image.png

SPetrie
13 - Pulsar

Here is a method I have used in the past. What @binuacs suggests will work to get them back in original order, but the union has a habit of letting the first streams' data types win. Because of that, its not always the safest method and I assume you want to keep your data type changes..

My method is more roundabout, but it seems to work well.

I use a field info tool at the point where the original fields are in the order we care about, then attach a string record id . On the other end of your joins, rename the fields using the record id instead, add in a select tool and have it sort by field name then another rename to get the names back to what they were.

If your number of fields will grow. you may want to pre-seed the select tool with a lot more fields than you currently have and just let them be missing for smaller datasets when the workflow runs just incase. 

 

example.PNGorder.PNG

Mond
8 - Asteroid

thanks for this, it does revert the order back, but the datatypes are reset @binuacs 

Mond
8 - Asteroid

@SPetrie thank you this works, but i do need to dynamically adjust the select :( will keep trying i guess

Labels