Alteryx Designer Desktop Discussions

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

Adding a zero to start of number

BBell
5 - Atom

Hi,

 

I need to add a zero to the start of number and have tried a few different ways but haven't managed to get the output I need.

 

The input data does not have a zero at the start of the number, I am bringing in the data as a string from the input data. The column includes some 4 digit codes and some 3 digit codes, if its a three digit code I want a zero to be included at the start. For example

 

Current 2100, 335, 100, 306, 3562

Need 2100, 0335, 0100, 0306, 3562

 

My cell is called ACC_Branch_Code, currently I have tried this

 

 iif(length([ACC_BRANCH_CODE_ES_4 ])== 4,[ACC_BRANCH_CODE_ES_4 ],"0"+[ACC_BRANCH_CODE_ES_4 ])

 

Do I need to fix the digits in the cell to force the zero?

 

Any help would be appreciated.

4 REPLIES 4
LordNeilLord
15 - Aurora

Hey @BBell

 

In the formula tool try:

 

PadLeft([ACC_Branch_Code], 4, "0")

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

ponraj
13 - Pulsar

convert the number column into string and prefix zero if the length is three,,,

BBell
5 - Atom

Thank you this worked

redlovesla
5 - Atom

Awesome! This solution worked for me as well.

 

Thanks for sharing.

Labels