Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Malformed IF Statement error

aeberhart
6 - Meteoroid

Hello, I am trying to identify social media sites in an external download and replace them with a non-null C-suite email address before comparing them to our internal data for fuzzy matching. The first step in this process will not run and I am having a hard time understanding why. The code below is my latest attempt but previous variations (one EndIF solely for the nested statement and adding a final Else for the initial If statement) did not work either. What am I missing here?

IF Contains([URL], 'facebook'||'twitter'||'instagram'||'linkedin'||'youtube'||'weixin'||'apple'||'email protected'||'blog.'||'medium' ||'innovative')
Then
IF IsNull([CEO Email]) == 0 THEN [URL] = [CEO Email]
ELSE
IF IsNull([CFO Email]) == 0 THEN [URL] = [CFO Email]
ELSE
IF IsNull([COO Email]) == 0 THEN [URL] = [COO Email]
ELSE
IF IsNull([CCO Email]) == 0 THEN [URL] = [CCO Email]
ELSE
If IsNull([CTO Email]) == 0 THEN [URL] = [CTO Email]
ELSE
If IsNull([CRO Email]) == 0 THEN [URL] = [CRO Email]
ELSE
if IsNull([CLO Email]) == 0 THEN [URL] = [CLO Email]
ELSE
[URL]
ENDif

ENDif

7 REPLIES 7
nagakavyasri
12 - Quasar

Contains statement should be Contains([URL], 'facebook')||Contains([URL],'twitter'), multiple or statements cannot be in a single Contains function

cjaneczko
13 - Pulsar

Try changing your first IF of 

 

 

IF Contains([URL], 'facebook'||'twitter'||'instagram'||'linkedin'||'youtube'||'weixin'||'apple'||'email protected'||'blog.'||'medium' ||'innovative')

 

to 

 

IF REGEX_MATCH ([URL],'facebook|twitter|instagram|linkedin|youtube|weixin|apple|email protected|blog.|medium|innovative')

 

One other thing, I think you need one more Else statement at the end where you have the following.

ELSE
[URL]
ENDif

ENDif

Think it needs to be 

ELSE
[URL]
ENDif
ELSE [URL]
ENDif

 

aeberhart
6 - Meteoroid

Thank you for the replies. I tried multiple combinations of both solutions and I'm still getting the error. Thinking of breaking this in to two different formulas now

cjaneczko
13 - Pulsar

I did test it with dummy data and it seemed to work without issue using the REGEX_MATCH and including the additional ELSE [URL] between the two ENDIFs. It was throwing errors until I added the additional ELSE. 

 

aeberhart
6 - Meteoroid

Interesting @cjaneczko . Here's what I tried to run and still got the Malformed error at the end. Am I missing something? 
aeberhart_0-1684935774790.png

 

cjaneczko
13 - Pulsar

Its tossing an error for me now when I replicate. I should have saved the sample workflow I created yesterday. Do you have a snippet of what the input data is and what the output should be?

aeberhart
6 - Meteoroid

I'll share some non specific examples that represent what I'm dealing with. The final site name should be isolated

 

https://www.facebook.com/bobbelcher is the listed website and the CEO email is loise@bobsburgers.com . Since the website has facebook in it, the desired output would be to replace the facebook site with the CEO email. Then the CEO email can be changed to bobsburgers.

 

www.linkedin.chamillionaire.com is the listed website and the CEO email is blank. Linkedin falls under our list of sites to change, however we have a CTO email address of herelizardlizard@chamilitary.net  . So we skip all the blank email addresses and find the first non-blank c-suite address which is the CTO. The website gets changed to the CTO email address and eventually chamilitary.net

Labels