Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Change specific character in field

aka_ash
8 - Asteroid

Hi,

 

Looking for some guidance on the below scenario.

 

For the example below how can I replace the 4th character in the Input to "." if it is a "D"?

 

InputExpected Output
1234567812345678
123D5678123.5678
123.456789123.456789
333D444D333.444D
919191DD919191DD
282828R28282828R28
AA1010101101AA1010101101
874D1234874.1234
54.123454.1234

 

Thanks in advance,

Ash

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

@aka_ash ,

 

no regex!

 

IIF( Substring([Input],3,1) = "D", Left([Input],3) + "." + Substring([Input],4) , [Input] )

 

 cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
huynv96
9 - Comet

Hi @aka_ash ,

It may help you:

Formular:

IF Substring([Input],3,1)="D"
THEN
Substring([Input],0,3) + "." + Substring([Input],4,Length([Input])) ELSE [Input]
ENDIF

image.png

aka_ash
8 - Asteroid

Hi @MarqueeCrew & @huynv96 ,

 

Thanks for your advice, great to see that there are a couple of ways to achieve the result, both methods work for me.

 

Thanks again,

Ash

Labels