Remove Column
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Solved! Go to Solution.
- Labels:
- Transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
