In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Add four "0" after the "-"

BautistaC888
8 - Asteroid

Hello,

I need to add four "0" after the "-"
Input:

BautistaC888_0-1623183026347.png

Output:

BautistaC888_1-1623183067372.png


Thank you.

3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

Hi @BautistaC888 

 

Assuming there's only going to be one hyphen, you can use a replace function to update the hyphen to have four 0s after it. 

 

replace([Entrega],"-","-0000")

 

Luke_C_0-1623183379857.png

 

cplewis90
13 - Pulsar
13 - Pulsar

Hey @BautistaC888,

 

You could use a standard formula tool and use this formula to add the 4 "0"s after the "-":

Left([Entrega], FindString([Entrega], "-")+1)+"0000"+right([Entrega], Length([Entrega])-FindString([Entrega], "-")-1)

Hollingsworth
12 - Quasar
12 - Quasar

It occurs to me that you may want to error trap for instances in which there are a different number of characters after the hyphen by using the padleft() function.

 

left([Field1],FindString([Field1], '-')+1) + padleft(Substring([Field1],FindString([Field1], '-')+1),8,'0')

 

With this formula, if the input is 1234-345 or 1234-45677, then the output would always be 13 characters: 1234-00000345 and 1234-00045677, respectively.

John Hollingsworth
Clear Channel Outdoor
Labels
Top Solution Authors