Free Trial

Alteryx Designer Desktop Discussions

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

Convert strings to number with decimals, and reconvert back to string

Luqman
7 - Meteor

Hi, I have this data

000000000532095750
000000000532095750
000000001675073760
000000001356737550
000000001356737550


Which values is actually(in real world)

5320957.5
5320957.5
16750737.6
13567375.5
13567375.5

 

 

I need to multiply this number by a percentage, lets say 50%

Amount50%
5320957.5  2,660,478.75
5320957.5  2,660,478.75
16750737.6  8,375,368.80
13567375.5  6,783,687.75
13567375.5  6,783,687.75



and then i need to convert the results back to the original string format, which is 18 characters

0000000266047875


I think the steps would be to
1) remove leading zeroes, 
2) Add decimals prior to last two digits

3) formula tool to multiply

4) find a way to add back leading zeroes up to 18chars

Help is appreciated

1 REPLY 1
rzdodson
12 - Quasar

@Luqman here is one approach. It is set up as an analytic app so you can toggle the percentage you need to calculate against the rest of the data. 

 

 Solution.png

I'll draw your attention to the last sub-formula within Formula (2). It is the Padleft function. Basically what it does is add characters to a text string based on the variables you defined, and there are three variables: 1) the text string you need to add characters to, the number of characters you need the text string to be, then what you want that new character to be ahead of the rest of the text string. PadLeft and PadRight are text-related functions, so you'll need to do your calculations against a numeric variable before applying PadLeft/Right functions.

Hope this helps!

Labels
Top Solution Authors