Alteryx Designer Desktop Discussions

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

Replace First Zero with Hyphen, But Not Second Zero

hellyars
13 - Pulsar

I have a 5 digit alpha numerica ID.  

I want to replace the first instance of "0" with "-", but keep any second instance of "0" if it exists.  

The first instance of "0" will always be in the 2nd or 3rd position.  

If a second "0" exists, it will always be in the 4th position.  

 

 

 

STARTDESIRED_OUTCOME
XT01AXT-1A
D010LD-10L
  
3 REPLIES 3
Luke_C
17 - Castor

@hellyars 

 

I think you can use the 'replacefirst' function for this. 

 

lukecornetta_0-1614614764984.png

 

hellyars
13 - Pulsar

@Luke_C  I did not know that function existed.  Thanks.

Emil_Kos
17 - Castor
17 - Castor

Hi @Luke_C 

 

This is cool I wasn't aware that there is a formula like this 😀

Thank you for sharing!

Labels