Alteryx Designer Desktop Discussions

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

How to convert string to number with decimal points

SteveKnapper
Astéroïde

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 RÉPONSES 4
DataBlender
Bolide

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

SteveKnapper
Astéroïde

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
Astéroïde

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

 

Sondage
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Étiquettes