Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Column Indices in Alteryx

Eivind
6 - Meteoroid

I have an input of an unknown number X columns, of which I always want to select only the 2nd last column. The column names will be different each time I do the operation. Is there any way to accomplish this in Alteryx? I imagine it would have to be through some sort of referencing to column indices (Think listName[-2] in Python).

 

Thanks in advance! 

3 REPLIES 3
jdunkerley79
ACE Emeritus
ACE Emeritus

Taking a very quick stab.

 

You can use a Field Info tool to get the last two columns.

 

You can then use transpose and cross tab to just select the data from these.

 

 A while ago I created a macro to a dynamic select. That makes this an easier problem. Attached as second case.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Eivind

 

Like my friend @jdunkerley79 i used the field info tool and created a module that is strikingly similar, but does find the 2nd to last column.  In the dynamic select tool there is a field number field that would be nice to use.  Our solutions have an issue with SPACEs in the field name.  I've handled it in my solution, but it could be problematic.

 

Capture.PNG

Hopefully between our posts there is a solution for you.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Eivind
6 - Meteoroid

Thanks a bunch to you both! This solves my problem. It also strikes me that it is possible to get the same effect by using two consecutive sampling-nodes: One selecting the two last rows, the next one selecting only the first. 

Labels