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

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