Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Error resulted in a string but the field is numeric use tonumber

Mostafa_Anwar
8 - Asteroid

Hi All,

 

i am struggling in this error "resulted in a string but the field is numeric use tonumber" despite the field type as Double in all previous SELECT tools, Also the formula is not provide me the required result, Appreciate your help pls 

 

Untitled.jpg

12 REPLIES 12
ChrisTX
15 - Aurora

If you want the data type for field "H1 Payout" to be numeric (double), remove the double quotes around the number at the end of each line of your IF statement.

 

Your IF statement sets values to String (identified by the double quotes), but you have the data type for the field set to Double.

 

Chris

 

Assaf_m
11 - Bolide

remove the " Quotation mark from the formula

grazitti_sapna
17 - Castor

Hi @Mostafa_Anwar,

 

Can you please use the values without quotes as given below and likewise:

 

If [a]<85 then 0

Sapna Gupta
Mostafa_Anwar
8 - Asteroid

Thanks for your respond, i have changed but still getting the same error as per the screenshot below

 

Untitled.jpg

grazitti_sapna
17 - Castor

Hi @Mostafa_Anwar , try using this formula

 

if [H1 Brands Ach.]<.85 then 0
elseif [H1 Brands Ach.]>=.85 then 2736
elseif [H1 Brands Ach.]>=1.20 then 32400 else 0 endif

 

The reason you are facing this issue is that as I can see in your screenshot you have used numbers which are comma separated and the datatype you used is double, trying changing the data type to v_string then it will work.

Note: Comma separated does not work for double datatype it only works for string.

Sapna Gupta
Mostafa_Anwar
8 - Asteroid

Error gone, Thanks for your support, But when i checked the output file i have noticed that the formula result is incorrect, As per formula should provide result 32,400 in case of achieved >1.20 but its giving 2,736 as per the screenshot below, 

 

Untitled.jpg

grazitti_sapna
17 - Castor

Hi @Mostafa_Anwar, you are facing this error because your second and third condition overlap . Try using the formula with below modification:

 

if [H1 Brands Ach.]<.85 then 0
elseif [H1 Brands Ach.]>=.85 and [H1 Brands Ach.]<1.20 then 2736
elseif [H1 Brands Ach.]>=1.20 then 32400 else 0 endif

Sapna Gupta
Mostafa_Anwar
8 - Asteroid

Thanks a lot, It worked!

mguerra1982
5 - Atom

Formula (689) The formula "Logistica Days" resulted in a string but the field is numeric. Use ToNumber(...) if this is correct. (Expression #1)

 

I have this error and suggest from alteryx is with ToNumber... but i doesn't work.

If ToNumber([NivelAvance]='Logistica' and [Country]='BRA')
then DateTimeAdd(ToDate(DateTimeNow()),+2,'days')
elseif ToNumber([NivelAvance]='Logistica' and [Country]='ARG')
then DateTimeAdd(ToDate(DateTimeNow()),+2,'days')
else 0
endif

 

Any suggest?

 

 

Labels