We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Discussions

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

Adding zero to make it 9 digits

PassION_es
9 - Comet

Hello Alteryx Team,

 

Needing assistance on the attached dummy input file. If the first column is D3, then the 2nd column should consist of 9 digits. If incase it only consist of less than 9 digits, then add zeroes in the beginning to make it 9:

PassION_es_0-1669122640572.png

 

In the example above, you can see that there are 3 values that does not contain 9 digits.  The output should be like this (all 9 digits) under D3:

 

PassION_es_1-1669122755220.png

Thank you in advance.

9 REPLIES 9
markcurry
12 - Quasar

Hi @PassION_es 

 

If you have leading zeros you'll have to change the field type to a string, then you can simply add the formula..

PadLeft([TIN (9 Digits)], 9, "0")

 

Hopefully that helps, 

 

Mark

gautiergodard
12 - Quasar

Hey @PassION_es 

You can do this using the padleft formula:

PadLeft([TIN], 9, '0')

 

Attaching workflow for reference! 

DenisZ
11 - Bolide

Use the formula tool and write 

 

PadLeft([TIN (9 digits)], 9, "0")

 

Hope this helps. Please mark as solved if is solved the issue.

ShankerV
13 - Pulsar

Hi @PassION_es 

 

You can achieve it by using the below formula

 

PadLeft([TIN (9 Digits)], 9, "0")

 

Many thanks

Shanker V

 

PassION_es
9 - Comet

hello All, 

 

I applied your formula, incorporated it in the conditions but I'm getting the result below:

PassION_es_0-1669124997294.png

I think there's something wrong with my conditions.

Can you check on this please? Thanks

ShankerV
13 - Pulsar

Hi @PassION_es 

 

Please see the below.

 

ShankerV_0-1669125127196.png

 

 

Input: 

ShankerV_1-1669125140814.png

 

Output:

ShankerV_2-1669125163614.png

 

 

gautiergodard
12 - Quasar

Hey @PassION_es 

Remove the below portion of your formula and you should get the expected result:

gautiergodard_0-1669125228087.png

 

binuacs
17 - Castor

@PassION_es  you need to adjust your formula like below

IIF([TYPE] = 'D3', PadLeft([TIN (9 Digits)], 9, '0'), [TIN (9 Digits)])

 

binuacs_0-1669125250401.png

 

PassION_es
9 - Comet

Amazing shortcut conditions. Thanks all!

Labels