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

Changing digits into specific words using Formula

Motivator
7 - Meteor

Hi, I hope someone can help as I can't find anything that covers what I want.

 

I have a field "Position" (int32) which has 3 incoming options:

 

Blank, 1,or 2

 

I would like to convert the digits to words i.e 

 

If Blank="Admin" else

If 1="Adviser" else

If 2="Director"

 

I am trying to use the Formula tool, but if something else is better please let me know.

 

Thanks

 

8 REPLIES 8
messi007
15 - Aurora
15 - Aurora

@Motivator 

 

Below how you can do it

 

if [Position] = 1
THEN "Adviser"
ELSEIF [Position] = 2
THEN "Director"
ELSE "Admin"
ENDIF

 

Regards 

atcodedog05
22 - Nova
22 - Nova

Hi @Motivator 

 

You can have a reference table and use join tool to map it. I am doing left join to keep all data from left (main data)

 

Workflow:

atcodedog05_0-1629728384334.png

 

Hope this helps : )

Motivator
7 - Meteor

Hi, messi007, it doesn't seem to like the second "="?

Motivator_0-1629729006817.png

 

atcodedog05
22 - Nova
22 - Nova

Hi @Motivator 

 

Seems like position in your data is string. Try this formula

 

if [Position] = "1"
THEN "Adviser"
ELSEIF [Position] = "2"
THEN "Director"
ELSE "Admin"
ENDIF

 

Hope this helps : ) 

atcodedog05
22 - Nova
22 - Nova

Join tool approach is suggested if you have n number of positions 🙂

messi007
15 - Aurora
15 - Aurora

@Motivator,

 

As I can see position is string field so you have to update the formula:

 

if [Position] = "1"
THEN "Adviser"
ELSEIF [Position] = "2"
THEN "Director"
ELSE "Admin"
ENDIF

Regards 

Motivator
7 - Meteor

Hi both of you thanks, yes I can see it was my mistake on the format. Started as int32 but then had previously changed to string.

Thanks to both of you for your quick response.

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @Motivator 

Cheers and have a nice day!

Labels