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

Text to columns - Parsing Data in a column that is not always present.

alex_reevoo
8 - Asteroid

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

 

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus

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 

 

alex_reevoo
8 - Asteroid

Brilliant, that worked a treat - thank you!

Labels