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!
Solved! Go to Solution.
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.
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.
Hopefully between our posts there is a solution for you.
Cheers,
Mark
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.