Alteryx Designer Desktop Discussions

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

How to convert string to number with decimal points

SteveKnapper
8 - Asteroid

Hello, I have a requirement to create a number with 2 decimal points from a string field.

 

e.g.

 

'9079' to '90.79'

 

Also the length of the string is not always the same

 

any suggestions would be greatfully appreciated

 

Steve

 

 

 

4 REPLIES 4
DataBlender
11 - Bolide

Wouldn't the easiest way be to convert the field into a number and then just divide by 100?

SteveKnapper
8 - Asteroid

Hi, many thanks for that a very easy answer to my problem

 

regards

steve

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@SteveKnapper,

 

Besides the suggestion to give @DataBlender an ACCEPTED SOLUTION, I was wondering about the 2 decimal places.  Are you converting 110 to 1.1 or to 1.10?  Are you displaying the final result as a string?  If you want to display the data, then:

 

ToString(ToNumber([Amount])/100,2)

If you also want a thousand separator:

ToString(ToNumber([Amount])/100,2,1)

Cheers,

 

Mark 

Alteryx ACE & Top Community Contributor

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

Hi Mark, no I wanted to convert my string to a number to then store as a currency value in SQL

but many thanks for the reply

 

regards

Steve

 

Labels