Start Free Trial

Alteryx Designer Desktop Discussions

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

Extract Numbers alone and padding with zeroes

Kallis
8 - Asteroid

Hello Friends

 

I have series of numbers like the below table. The first TWO characters could be 3P or SZ or 5T or 11. 

 

The requirement is that I need to remove the first couple of characters only if it is a combination of alphanumeric. If they are pure numeric like 11, I need to pad it with ZEROES for a total length of 10. For padding I can use the function padleft but please suggest about the first requirement

 

InputExpected OutputLength of expected output
3P0000311575000031157510
SZ0000356789000035678910
SZ00003567000000356710
5T0000356789000035678910
1100003567110000356710
11000035001100003510
110000356011000035610
1100003000110000310

Thanks

 

5 REPLIES 5
alexnajm
18 - Pollux
18 - Pollux

Can you show us the expected output to be safe?

Kallis
8 - Asteroid

Hi @alexnajm 

 

I have given a simple example in the original text.

alexnajm
18 - Pollux
18 - Pollux

Thank you! This works for me for the data provided: IF REGEX_Match([Input], "\d+") THEN PadLeft([Input], 10, '0') ELSE PadLeft(Substring([Input],2,10), 10, '0') ENDIF

PangHC
13 - Pulsar

 

 

if Left([Input], 2) in ("3P","SZ","5T") then
  Substring([Input],2,10)
else
  [input]
endif

 

 

 

Kallis
8 - Asteroid

Thanks @alexnajm @PangHC 

 

I went with Alex's solution. It worked perfectly. @PangHC I will make use of your solution in the future.

Labels
Top Solution Authors