Knowledge Base Article

Removing Leading Zeros

Question:

What is the best way to remove leading zeros?  I have a field that is alphanumeric values (JONESBJ001, SMITH KC02, 0000012345, 0000555213.
 

Solution:

If all of your data with leading zeros will always be some sort of numerical string (ie there will not be values like 000{character}) you could create a custom column using the following expression in an Elasticube:
 
CASE 
WHEN Left([Values],1) = '0' THEN ToString(ToInt([Values]))
ELSE [Values]
END
Updated 11-17-2023
No CommentsBe the first to comment