Alteryx Designer Discussions

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

Sort File Base on Column Value

fjlorenzo
8 - Asteroid

Hi,

I need to determine if certain row should be included or not. If the "Email Address" column only contains yahoo email address "don't include", if it contains yahoo email address and also other email address "include" this row. Thank you for your help.

 

Email AddresssNotes
john.andrew@yahoo.comdon't include
fjlorenzo@gmail.cominclude
romylorenzo@gmail.com;maloudeguzman@yahoo.cominclude
joadaya@yahoo.com;thessdalmacio@gmail.com;janebuglosa@outlook.cominclude
thessdelacruz@yahoo.comdon't include

 

 

3 REPLIES 3
KaneG
Alteryx Alumni (Retired)

Hi @fjlorenzo

 

The quickest solution here is an If statement and replace all the @yahoo.com. Don't worry, it's not actually changing your original data.

 

IF REGEX_CountMatches(Replace([Email Addresss],'@yahoo.com',''),'@')
THEN 'include'
ELSE "don't include"
ENDIF

 

KaneG_0-1637298356152.png

 

fjlorenzo
8 - Asteroid

Hi @KaneG ,

 

Thank you so much. Would you be able to explain how this works? Just wanted to understand the IF statement how it works.

 

Regards,

Florence

danilang
18 - Pollux
18 - Pollux

Hi @fjlorenzo 

 

Just stepping in with a quick explanation.  What @KaneG's clever solution does is replace "@yahoo" with a blank and then the Regex_countmatches() function counts the number of remaining "@".  If there's at least one, it means that the original had at least one non-yahoo address so the line is marked as include.  If there are no matches, that means that the original has only yahoo address or no email addresses at all.  

 

Very clever, indeed! 

 

Dan 

Labels