Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Number stored as string converts to 0 when converted to double using ToNumber or Select

bwat2435
7 - Meteor

Hi All,

 

I have a column of numbers that are stored as  V_String. I need to do some arithmetic on them so tried converting to Double using both the Select tool and ToNumber formula. Both times, all of the "numbers" were converted to 0. This has never happened to me before so I'm not sure what to do.

 

Any ideas please?

8 REPLIES 8
Qiu
20 - Arcturus
20 - Arcturus

@bwat2435 
Can you give us some sample of the strings, or the workflow even better.

atcodedog05
22 - Nova
22 - Nova

Hi @bwat2435 

 

As @Qiu  mentioned if you give us the scenario where you are facing the issue. We can troubleshoot it for you 🙂

bwat2435
7 - Meteor

Thank you both!

 

See attached a subset of the data. Column A is what I parsed, and columns C and D are the two columns that have data that needs to be converted to a Double. Note - this works for column D but not for column C.

 

Thanks in advance!

Qiu
20 - Arcturus
20 - Arcturus

@bwat2435 
I think there is leading space in your C column and with Cleansing Tool we can fix it.
But curiously, Alteryx usually gives warning for this.Capture3.PNG

atcodedog05
22 - Nova
22 - Nova

Hi @bwat2435 

 

There is leading space before the number. Hence it was creating issue. 

By using data cleansing tool you can remove it and convert. I have a dummy calculation C+D

 

Output:

atcodedog05_0-1602652491600.png

Workflow:

atcodedog05_1-1602652506792.png

 

Hope this helps 🙂

 

If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

Qiu
20 - Arcturus
20 - Arcturus

@atcodedog05 
You need to give my thread a like aso,  buddy.😁

cgoodman3
14 - Magnetar
14 - Magnetar

edit: just seen @Qiu and @atcodedog05 have given you replies, but just in case others come across this thread as well as the space below are other common conversion errors.


Do your numbers have things like commas like this 1,425 or currency symbols like $244.58? If so then you’ll need to remove these using a formula tool with the replace function first.

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
RolandSchubert
16 - Nebula
16 - Nebula

Hi @bwat2435 ,

 

another option would be to use a Multi-Field Formula tool to remove spaces, I think it's the more flexible as you can customize is to your specific needs. The attached sample removes spaces only, but can easily be extended to other characters.

 

2020-10-14_08-05-12.png

 

Best,

 

Roland

Labels