Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to convert string to number?? example "-12 789,32"

ShravaniChanda
8 - Asteroid

Hello,

 

I am exporting the data from SAP and the balance are in this format "-12 389,32" or "-79 456,43" or "42 761,59". It contains spaces a thousands separator and comma for decimal separator. Whenever I choose the type int or double in select the output result would be in  -12 or -79 or 42. choosing float or fixed decimal would result in null. Can someone help in converting it to number. 

ShravaniChanda_0-1646326134102.png

 

5 REPLIES 5
binuacs
21 - Polaris

@ShravaniChanda 

toNumber(ReplaceChar([Amount], ' ,.', ''))

binuacs_0-1646326465814.png

 

JosephSerpis
17 - Castor
17 - Castor

Hi @ShravaniChanda you need to replace the commas first then you can convert the field to a numeric without loss of data.

ShravaniChanda
8 - Asteroid

Hi @JosephSerpis 

 

Thanks for the prompt response, but the problem here is I want to output the data in the same format to an excel.

for example -  "-12 389,32" is in string first, then after conversation also it should be in the reman same as "-12 389,32" so that when i output that into excel the it will be populated as numeric field.  

ShravaniChanda
8 - Asteroid

Hey @binuacs ,

 

I appreciate your reply, but i want the output to look exactly same as the input but the datatype to be in numeric. I am updating this data to an excel template, where there are many calculated columns in excel depending on this output column. 

 

Please advice

binuacs
21 - Polaris

@ShravaniChanda I don't think the Alteryx string format (-12 389,32) can be outputted to excel as numeric. you need to pass the amount as numeric then format the excel to reflect according to your requirement

Labels
Top Solution Authors