Alteryx Designer Desktop Discussions

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

Select tool ordering of fields. Is there a way to keep the fields from changing order?

wonka1234
10 - Fireball

Hi,

 

I run my workflow on a server. and different months are chosen each time (see photo)

 

now i ran it locally and before my select tool the fields are in order.

 

After they the select tool ran , they get shifted to the end (some of them)

 

why is this happening? Is there a way to keep the months chosen grouped together?

 

10 REPLIES 10
cjaneczko
13 - Pulsar

You'll likely need a macro. I have this issue with a workflow I run monthly where the fields would get out of order. Take a look at the below macro flow. It uses a Field Info tool with a record ID tool to set the order of the fields. Then it concatenates the Record order to the Field names and cross tabs it. Once Cross tabbed it uses the Dynamic Rename tool to rename the column headers in the appropriate order and removes the Sort Order prefix. 

 

Ignore the Lower Input tool and Union as I am also grabbing field names from another file to add into this one.

 

image.png

 

You can also try out the CReW Field Sort macro.

 

http://www.chaosreignswithin.com/2014/08/field-sort-macro.html

wonka1234
10 - Fireball

@cjaneczko 

 

posting specific example -

 

problems:

 

1) 20221031 should come before 202211  

 

2) Is it possible to insert the date columns between "folder" and "test" dynamically?

 

ie from 

 

201031foldertest

 

to

 

folder20221031test
cjaneczko
13 - Pulsar

To solve the 20221031 issue, add a Record ID tool after your filter and concatenate the Record_ID to the Name field. This will preserve the field order. As for putting the 20221031 between the Folder and Test, will 2021031 always be the field name or is it dynamic and can change?

wonka1234
10 - Fireball

@cjaneczko  ok thanks! u solved my issue #1!

 

20221031 can change.. its dynamic..  ie

my output is this

 

20221031202211202212etcetcetcetccol 1col 2 col 3

 

could be any dates in the first 3 columns there.

 

Need a way to insert it affter a certain column...

cjaneczko
13 - Pulsar

Which columns are always first and static? Where do you need the 3 date columns? And what is after those 3 Dynamic Date columns. You will likely need a couple field info tools and some Multi Row Formulas to accomplish it. You'll essentially need to create some Record ID's with the multi Row Formula. The Record ID can capture the fields that will always be static. Then use the Multi Row formula to create a Record_ID count that starts after the number of fields that are Static. So if you have 4 fields in the front that are static use Record ID to count 1-4. Then use the Multi Row formula to create a Record ID starting from 5 onward. Union all these together to get the fields in the correct order based on the Record ID's and then Cross tab then like you've already done.

 

You may also need a sample tool to dynamically grab the first three dynamic date records.

cjaneczko
13 - Pulsar

Is this the output you are looking for?

image.png

 

 

wonka1234
10 - Fireball

@cjaneczko  yes that is the output.  not sure if you can alter my workflow to get this...

cjaneczko
13 - Pulsar

See attached.

wonka1234
10 - Fireball

@cjaneczko  thanks! u the man!! testing it more thoroughly now..

Labels
Top Solution Authors