We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Select Columns based on position

gwiz
8 - Asteroid

Is there a way to select columns based on position? I want to delete all columns to the right of a column labeled "Indicator". That column name is irrelevant, but the idea of removing columns to the right of a specific column is what I'd like to do. I did come up with one way to do it but was curious if there is another way.

My way was to:

1) take the first record, then transpose to get the names of the columns in the "Name" column.

2) I used a  record id tool to provide a record for each column.

3) Then I used a formula tool to add record id and "Name" column.

4) Next, I dynamic renamed using "take field name from right input rows". So now the column labeled "Indicator" actually is labled "17_Indicator".

5) Lastly I used a dynamic select with a formula "ToNumber(Left([Name], 2)) <= 17" which dropped the other columns obviously.

 

I am not sure this sequence is the most efficient way. Is there another way to deselect columns to the right of a specific column? Thanks!

4 REPLIES 4
Thableaus
17 - Castor
17 - Castor

Hi @gwiz 

 

There's an option to select "Field Number", which is the position of your column in your dataset.

 

snip3213.PNG

 

 

Cheers,

CharlieS
17 - Castor
17 - Castor

^ In the Dynamic Select tool. 

 

 

To do all the action you described, I would probably go about it in the same way you already have. One suggestion would be use the Field Info tool to get the names rather than sampling a record and transposing. 

gwiz
8 - Asteroid

That certainly helped! Thank you thank you @Thableaus! good thing to know now going forward

gwiz
8 - Asteroid

Yes thats a good thought too @CharlieS, thanks

Labels
Top Solution Authors