Alteryx Designer Desktop Discussions

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

How to return multiple values in 1 "if " statement

shailendra88
6 - Meteoroid
Hi all, I am new to alteryx. Please help me with below. question :- if USER=ABC then return ID=10,20,30 ELSE 40,50,60 END IF please help me achieve this. thanks in advance.
7 REPLIES 7
messi007
15 - Aurora
15 - Aurora

@shailendra88,

 

Could you please give more details with a sample input of the data and a sample of what you expect to have.

 

Best Regards,

echuong1
Alteryx Alumni (Retired)

If I understand what you're looking for, you were on the right track. Place strings in quotation marks. You can set your output field in the expression.

 

Hope this helps!

 

echuong1_0-1613498089670.png

 

shailendra88
6 - Meteoroid
Please find data as below:_ user id abc 10 abc 20 abc 30 abc 40 xyz 10 xyz 20 xyz 30 in workflow I want to pass only User ="ABC" and ld 10 , 20 and 30. So I was trying IF statement in filter and formula, both of then individually Like :-for ID column :- if User="ABC" then (10 or 20 or 30) else [id] endif
pedrodrfaria
13 - Pulsar

@shailendra88 Are you trying to do something like this?

 

pedrodrfaria_0-1613681233685.png

 

Pedro.

shailendra88
6 - Meteoroid

Thanks, 

is there anyway i can write your statement in IF statement, so that in future if i want to process other user also it should not block them, like for USER=‘ABC’ then it will process only 10,20 and 30 but if i get any other User then it should not block them, 

Like if I get user EFG then it should process all the related id.

 

i thinks if we write your statement under IF or IIF or SWITCH that can resolve the issue,

but I am not able to do so.

I tried as below:-

 

IF USER=“ABC” then ID IN(10,20,30)

else ID

ENDIF

 

APOLOGY if i am not able to explain properly.

shailendra88
6 - Meteoroid

Thanks a lot,

in you statement we are returning”10,20,30” that is term as 1 string output, now consider 10,20 and 30 as separate ids,

how can we write same statement,

i tried as below but didn’t work for me:-

if user=“ABC” then id in(“10”,”20”,”30”)

else ID

end if

 

in this case if ABC then it will process 10,20 and 30 but if any there user is there then all the ids will be processed for that user

messi007
15 - Aurora
15 - Aurora

@shailendra88,

 

In this case you can use:

1-

if user=“ABC” then

 if id in (“10”,”20”,”30”)

then "10"

else ID

else ID

endif

OR

2- 

 

if user=“ABC” and id in (“10”,”20”,”30”)

then "10"

else ID

endif

 

With If statement you have to add  else statement  

 

Hope this helps,

Regards,

Labels