Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

ToNumber converting string zero

lavorarchi
7 - Meteor

Hi 

 

I have a simple query hopefully someone can provide me with a solution for. In the attached example, I would like the "0" line to come through as "T" output on the Filter element. Currently it is appearing as "F".

 

Thank you in advance.

10 REPLIES 10
atcodedog05
22 - Nova
22 - Nova

Hi @lavorarchi 

 

The issue you are facing is. 0 is false and 1 is true of Boolean. Hence 0 is going to False.

If you are trying to check whether its a number you can use IsNumber() or !Isnull(ToNumber())

 

Here is the workflow:

atcodedog05_0-1608037920663.png

 

Hope this helps 🙂

lavorarchi
7 - Meteor

Thank you @atcodedog05 this is useful. I could have in field2 string values e.g. text as well as numbers. Currently they are all treated as strings. I need to filter all numeric values as T and all string/text values as F. It is working except for the '0' where they are being shown as F.

atcodedog05
22 - Nova
22 - Nova

Hi @lavorarchi 

 

Try something like this

REGEX_Match([Field2], "[\d\.]+")

Input:

atcodedog05_0-1608038743982.png

Output:

atcodedog05_1-1608038765323.png

Hope this helps 🙂

 

lavorarchi
7 - Meteor

Excellent. Thank you for your help. Much apprecaited.

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @lavorarchi 

 

Cheers and Happy Analyzing 😀

 

Feel free to reach out if you face any issues 🙂

lavorarchi
7 - Meteor

Sorry one final question, your REGEX_match working like magic. Only thing I have noticed it is not including the negative numbers. Is it just matter of removing the + from the syntax? 

atcodedog05
22 - Nova
22 - Nova

Hi @lavorarchi 

 

No use this regex

REGEX_Match([Field2], "[-\d\.]+")
atcodedog05
22 - Nova
22 - Nova

Hi @lavorarchi 

 

If you are interested to explore regex. Here is a resource.

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-RegEx/ta-p/37689

 

Hope this helps 🙂

lavorarchi
7 - Meteor

Legendary! Thank you.

Labels
Top Solution Authors