Alteryx Designer Desktop Discussions

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

delete zeros at beginning of a number

NicoLehmann
6 - Meteoroid

NicoLehmann_0-1685989142476.pngNicoLehmann_1-1685989153711.png

I have these two tables, that i want to join. But as you see one of them has two 00 in beginning.

 

How can i delete from the first table the first two zeros or ad them to the other table. But i would prefer to delete them.

3 REPLIES 3
DataNath
17 - Castor

Hey @NicoLehmann, as the field will be stored as a string you can use the TrimLeft() function to remove the '0' characters from the start:

 

DataNath_0-1685989952212.png

 

If the other field - in the second table - is numeric then you'll need to add a Select tool and make them uniform (i.e. both numeric or both strings) in order to be able to conduct a join.

acarter881
12 - Quasar

Hello, @NicoLehmann.

 

I would use a Regular Expression inside a Formula tool. I would use the REGEX_Replace function to match a pattern that has any number of leading zeroes, but only return the digits after the leading zeroes.

 

Please see the screenshot and the attached workflow.

 

acarter881_0-1685989926984.png

 

xariet
8 - Asteroid

Thank you for the formula, but what does "$1" exactly mean? You are replacing any number of leading zeros with what? 

Labels