Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Add a "0" to the Beginning of String

RifferX
8 - Asteroid

Hello -- I have NCPDP numbers where some begin with 0 and are 7 characters. I want to change the data after the fact (takes me over 6 hours to run this script) to include the 0 in front when it gets removed and the NCPDP is only 6 numbers in a string. In excel, this is a simple formula of =TEXT([@NCPDP],"0000000"). So, the output will always be 7 characters but where there is a 0, it will be included instead of blank and the string only being 6 characters. I need to join this later to other strings that already include the 0. So an NCPDP # of 430495 should read 0430495 as a string.

 

I can't figure out how to do this in Alteryx using the Formula tool. I do not want to have to rerun this script again and add the Select tool to change to string before it is saved to yxdb file. I have over 14 million rows. Any help is appreciated.

 

--Russ

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

Hey @RifferX ,

 

No problems.  Try this solution:

 

PadLeft([@NCPDP],7,"0")

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
RifferX
8 - Asteroid

@MarqueeCrew Thanks sir. I actually just figured it out myself.

Labels