Alteryx Designer Desktop Discussions

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

Format Numbers

kasey317
5 - Atom

Hello, 

 

I need help formatting a column of data. The column has a series of numbers, but not all of the numbers are 9 x characters long. I have spent hours trying all sorts of ways to format the numbers and I can't figure it out. Hopefully someone in the community has the answer? 

 

Thank you, 

Kasey

 

Example #1

100000000 (this one is correct)

94987759 (the correct number should read: 094987759)

 

Example #2

276489378 (this one is correct)

922753 (the correct number should read: 000922753)

 

 

 

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

@kasey317 ,

 

 numbers don't start with zeros.  Strings do. So if the data type is string, you can use:

 

padleft([field],9,"0")

 

If the field is numeric, you'll need to change the tire to string first with a select or use a new field. 

padleft(tostring([field]),9,"0") cheers, mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Qiu
21 - Polaris
21 - Polaris

@kasey317 
Just as @MarqueeCrew said, the numbers can not have leading zeros.

So we have to turn it into strings, then when using it, use ToNumber function to change it back to numeric.

Labels