Alteryx Designer Desktop Discussions

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

How to reverse a name

Saravanan13
8 - Asteroid

Hello all,

 

I am looking to reverse a full name, I need the output as shown in Actual name. Can anyone help.

 

 

Full nameActual Name
John Smith PaulPaul Smith John
Alex StuartStuart Alex
6 REPLIES 6
Saravanan13
8 - Asteroid

Hello all,

 

I need the reversal to happen based  on condition, say whenever country = China,Singapore,Hong kong.

 

Full nameActual NameCountry
John Smith PaulPaul Smith JohnChina
Alex StuartStuart AlexSingapore
binuacs
20 - Arcturus

@Saravanan13 One way of doing this

image.png

CoG
13 - Pulsar

Here's another method that ran faster for many records on my machine

Actual Name.png

ds_tomalexsmith
8 - Asteroid

I don't know if I'm missing something, but the other replies seem to have really overcomplicated this. Hopefully this is what you were looking for 😊

Solution reverse_name.png

Solution reverse_name (formula).png

flying008
14 - Magnetar

Hi, @Saravanan13 

 

I assume that the name for your specified region only has a maximum of 6 words, but in reality it is not that many. Therefore, you can simplify the logical level of the formula.

 

 

 

Trim(IIF([Country] in ('China', 'Singapore', ',Hong kong'), GetWord([Full name],5) +' ' + GetWord([Full name],4) +' ' + GetWord([Full name],3) +' ' + GetWord([Full name],2) +' ' + GetWord([Full name],1) +' ' + GetWord([Full name],0), [Full name]))

 

Or like:

Trim(IIF([Country] in ('China', 'Singapore', ',Hong kong'), GetWord([Full name],2) +' ' + GetWord([Full name],1) +' ' + GetWord([Full name],0), [Full name]))

 

录制_2023_11_13_08_27_08_813.gif

caltang
17 - Castor
17 - Castor

Their first and last names are all ordered the same? Or is it always the last name word gets swapped with the first name word? Because names can get complex if the conditions aren't limited, and some may not return what you want...

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels