Alteryx Designer Desktop Discussions

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

Remove Column

OsakaPaul
5 - Atom

First column does not have a header and is a list of numbers. Other columns have headers. I would like to remove the first column.

2 REPLIES 2
Storm
9 - Comet

Is there also some value in that first field on the top row - or at least a comma there to mark where a field would be?

 

If so, here's my suggestion:

 

  • On input, indicate first row is NOT a header record.
  • File therefore comes in with fields named field1, field2, field3, etc. Your true headers are in "row #1".
  • Use select tool to deselect field1.
  • Use dynamic rename tool on remaining data to take the column headers from first row of data (fourth option from top in rename mode).
Storm
9 - Comet

If there is NOT a value in the first field on the first row - so e.g. your data looks something like this:

 

FIRST_NAME,LAST_NAME
25,John,Smith
16,Michael,Jones
345,Donald,Trump
18,Hillary,Clinton
225,Elvis,Presley

 

...where you have some header fields and they are meant to refer to fields 2 thru X, then the attached workflow should work.

 

On your input you want to again indicate first row is NOT a header. And make the delimiter this:

\0

 

This tells Alteryx to bring the data in as a line of text, versus individual fields.  This would get you up to the same point as the output of tool #1 in the attached workflow.

 

The logic of what it's then doing is:

  • Using a filter to identify the row which is the true headers
  • Parsing that to the correct number of fields (i.e. the number of columns your final output should have)
  • DEselecting out the combined field which it parsed from
  • Parsing out the "false" side of the filter (which is the data itself) to the correct number of fields (i.e. INCLUDING that first number column)
  • DEselecting out both the combined field which it parsed form, and that number field you don't want
    Unioning back together - ensuring the "header portion" is #1 - and using the "auto config by position" selection in the join tool (not the default)
  • Using the same dynamic rename as in my first suggestion - to take the column headers from the first row

 

Should work fine.

 

ax_comm_scrnsht_descope_first_column.png

Labels