Alteryx Designer Discussions

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

Multiple expressions in Conditional statements

basub
6 - Meteoroid

I am trying to perform 2 transformations of values in a field  and one of which will be conditional.

 

IF [TAIL]="E-KAI" THEN "EFXF" ELSEIF [TAIL]="C-FXY" THEN "N6FE" ELSE [TAIL] ENDIF

ReplaceChar([TAIL],'-','')

Unlike other programming languages, I am unable to insert the ReplaceChar function for all conditions neither is there an option to submit multiple expressions for column in the same Formula tool. I am finding that I have use multiple iterations in Alteryx compared to what I can do in Excel VBA script or SQL script in MS Access.

 

Any help here ?

3 REPLIES 3
jdunkerley79
16 - Nebula
16 - Nebula

I think you want something like:

 

ReplaceChar(
SWITCH([TAIL],
       [TAIL], // Default value
       "E-KAI","EFXF", // IF E-KAY ==> EFXF
       "C-FXY","N6FE") // IF C-FXY ==> N6FE
,'-','')

 

Formulas in Alteryx are more like formulas in Excel than programming statements. 

MSalvage
11 - Bolide

@basub,

 

I may be misunderstanding what you are trying to achieve, but couldn't you just add the ReplaceChar function to the else? like so:

 

IF [TAIL]="E-KAI" THEN "EFXF"

ELSEIF [TAIL]="C-FXY" THEN "N6FE"

ELSE ReplaceChar([TAIL],'-','')

ENDIF

basub
6 - Meteoroid

jkunderley79's solution worked elegantly. 

 

@MSalvage - Your suggestion might work too that I can try.

Labels