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

Regex for conditions to concatenate columns

GoldenDesign04
8 - Asteroid

I have a dataset where the data is fairly fragmented. With plenty of missing information. Thankfully I was able to find the supplemental data in another table. I need a way to smartly merge these fields together.

 

I figure a regex character match is the best option but my regex is very rudimentary. 

 

Examples are as follows:

Station NameOutlet Name
East SDTV Guide
West SDTV Guide
CH 14NBC
CH 11NBC
National HDTV One

 

Expected output

Station NameOutlet Name
TV Guide East SDTV Guide
TV Guide West SDTV Guide
NBC CH 14NBC
NBC CH 14NBC
TV One National HDTV One

 

There are over 2k rows and several hundred unique values for Station Name. Most where the data is missing follow similar formats as the ones above. In essence I need a regex (or similar formula) that matches on a format:

IF [Station Name] = "CH ##" then concat [Outlet Name] +  [Station Name]

 

IF [Station Name]  CONTAINS "SD" then concat [Outlet Name] +  [Station Name]

 

 

2 REPLIES 2
jasperlch
12 - Quasar

Hi @GoldenDesign04 

 

You could use the formula below: 

 

if REGEX_Match([Station Name], "CH \d+") or EndsWith([Station Name]," SD") or EndsWith([Station Name]," HD")
then [Outlet Name] + " " + [Station Name]
else [Station Name]
endif

 

 

In the formula above "\d+" means one or more numeric characters.

 

Attached is a sample workflow.

 

Jasper

KK12
7 - Meteor

Based on your example, it seems you want to concatenate each row.

Is it?

Labels