Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Adding area code to phone number

Dev11
5 - Atom

Hi guys Newbie here I was wondering if anyone could give me a solution as to how I can add the UK area code on a field with the format 7xxxxxxxxx so it looks like +44 7xxxxxxxxx.

IF StartsWith([Phone], "7") THEN ReplaceFirst([Phone], "07", "+44")
ELSE [Phone]
ENDIF

I was using this but it does not seem to work

 

3 REPLIES 3
ShankerV
17 - Castor

Hi @Dev11 

 

Please try the below.

 

IF Left(tostring([Field1]), 1) = "7"
THEN "+44 " + ToString([Field1])
ELSE [Field1]
ENDIF

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @Dev11 

 

In the IF condition, we are checking whether the first digit is 7
If yes, then adding +44 as per your requirement
Else then displaying the same phone number

 

Hope it helps!!!

 

Many thanks

Shanker V

Dev11
5 - Atom

Thanks Shankar worked like a charm

Labels
Top Solution Authors