Text to columns - Parsing Data in a column that is not always present.
- 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
Hi Alteryx Community,
There is most likely a much more sensible way of doing this.
I am currently building out a data export for a client. The export has a large amount of fields. The report will be set to run weekly.
A few of the columns being exported needs to be cleaned in order to remove a pipe character and subsequent text. Initially I sought to solve this by adding in a number of "text to columns" tools and simply dropping everything after the pipe. The problem is that the nature of the data means that occasionally, some of those columns aren't present (because the data is not there for that week).
On other tools I know there is functionality to "ignore errors" however I cannot see that with text to columns. Is there any way I can do this more cleverly?
Hope that makes sense and look forward to having some wizards post some solutions!
Thanks,
Alex
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I would suggest using a Multi-Field Formula tool operating on all Text fields.Make sure you untick the Copy box then an expression like:
REGEX_Replace([_CurrentField_], "^([^\|]+)\|?.*$", "$1")
should work.
If you have a known list of fields then I would do something like:
IIF([_CurrentFieldName_] IN ('FieldA', 'Another'), REGEX_Replace([_CurrentField_], "^([^\|]+)\|?.*$", "$1"), [_CurrentField_])
would allow for easy filtering
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Brilliant, that worked a treat - thank you!