Alteryx Designer Desktop Discussions

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

Create a new column using a portion of info from another column

workgirl
5 - Atom

I want to create a new column from data in an existing column. I need to find the file extension in the existing column then put text into a new column based on the extension. See below:

 

ExistingCol

filename.ai

filename.png

filename.docx

filename.pptx

 

NewCol

Adobe Illustrator

Image

Word Doc

Powerpoint

 

I am using the Formula tool to create a new column and have written an IF statement to test if I can do this and am getting a parse error and I'm not sure why.

 

IF contains([FileName],".ai") then
"Adobe Illustrator"
ENDIF

 

Why isn't this working? 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @workgirl 

 

The reason would the IF block goes like

 

IF (condition) Then action

Else action EndIF

 

You are missing the Else Part

atcodedog05
22 - Nova
22 - Nova

Hi @workgirl 

 

Here is a formula for the task.

IF contains([FileName],".ai") THEN "Adobe Illustrator" 
ELSEIF contains([FileName],".png") THEN "Image" 
ELSEIF contains([FileName],".docx") THEN "Word Doc" 
ELSEIF contains([FileName],".pptx") THEN "Powerpoint" 
ELSE Null() ENDIF

Output:

atcodedog05_0-1602524927090.png

 

Hope this helps 🙂

 

If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

workgirl
5 - Atom

Thanks. Added the balance and it works great.

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @workgirl 

 

Cheers and Happy Analyzing 😀

Labels