Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Writing an If statement with multiple OR and AND

Georgia_H
8 - Asteroid

Hi, i need help to reconstruct this if-else logic. I'm not getting the correct result. Appreciate your advice.

Thanks in advance.

 

My objective:

 

1. I want to check if QUA_AST_DNS column contains 'sglife' keyword and then check on QUA_AST_IP column if Startswith "10.181." or "10.183." If true, output as PSAS.

2. The 2nd IF statement is to check on DNS column contains 'sglife' keyword and then check on IP_address column if Startswith "10.181." or "10.183." If true, output as PSAS.

3. If both conditions above don't meet, then take LBU as output.

 

IF Contains([QUA_AST_DNS],'sglife') &&
(Startswith([QUA_AST_IP],"10.181.") OR
Startswith([QUA_AST_IP],"10.183.")) then 'PSAS'
ELSEIF Contains([dns],'sglife') &&
(Startswith([IP_address],"10.181.") OR
Startswith([IP_address],"10.183.")) then 'PSAS'

ELSE [LBU]

ENDIF

6 REPLIES 6
binuacs
20 - Arcturus

@Georgia_H Your formula seems to be working fine with my dummy data

 

IF Contains([QUA_AST_DNS], 'sglife') 
	AND ( StartsWith([QUA_AST_IP], '10.181.') 
		OR StartsWith([QUA_AST_IP], '10.183.') ) 	
Then 'PSAS'
ELSEIF Contains([dns], 'sglife') 
	AND ( StartsWith([IP_address], '10.181.') 
		OR StartsWith([IP_address], '10.183.') ) 
Then 'PSAS'
Else [LBU]
EndIf

 

 

binuacs_0-1650012780701.png

 

Georgia_H
8 - Asteroid

Thanks, let me check my the results again.

apathetichell
18 - Pollux

@Georgia_H-- quick clarification - you tagged this Designer Cloud. Are you running this on Desktop or cloud? @binuacs tested on Designer. If there are syntax issues on Cloud we'd have to test there.  (note - there shouldn't be syntax issues on Cloud but...)

Georgia_H
8 - Asteroid

Apologies, it was tagged wrongly. Just running this on Desktop.

binuacs
20 - Arcturus

@Georgia_H are you able to fix the issue?

Georgia_H
8 - Asteroid

@binuacs Thanks for the follow up and assistance. The formula was correct. Just that we had another logic that countered the output after i applied this formula. 

Cheers.

Labels