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

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
19 - Altair
19 - Altair

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