Alteryx Designer Desktop Discussions

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

I am getting an error - the field resulted in a string but it is numeric.

Marcegon
8 - Asteroid

Hi, I am getting an error "the field resulted in a string but it is numeric".   Alteryx is suggesting to add the ToNumber formula. 

My data type is "int64", so I don't know what I am doing wrong. 

Can someone let me know how to apply the ToNumber formula to the statements below?  Any help will be much appreciated!  

 

Virtual column

If IsNull([Actual # of Virtual Attendees]) THEN [Virtual est attendees] ELSE [Actual # of Virtual Attendees] ENDIF

 

In-Person column

If IsNull([Actual # of In-person Attendees]) THEN [Request Expected Attendees] ELSE [Actual # of In-person Attendees] ENDIF

 

Total Attendance

[Attendance - InPerson]+[Attendance - Virtual]

8 REPLIES 8
ShankerV
17 - Castor

Hi @Marcegon 

 

Solution:

 

Virtual column

If IsNull([Actual # of Virtual Attendees])
THEN tonumber([Virtual est attendees])
ELSE tonumber([Actual # of Virtual Attendees])
ENDIF

 

In-Person column

If IsNull([Actual # of In-person Attendees])
THEN tonumber([Request Expected Attendees])
ELSE tonumber([Actual # of In-person Attendees])
ENDIF

 

Total Attendance

tonumber([Attendance - InPerson])+tonumber([Attendance - Virtual])

 

 

I have mocked up the data to explain your issue.

 

ShankerV_0-1682481892273.png

 

ShankerV_1-1682481907206.png

 

ShankerV_2-1682481919915.png

 

 

The column ACTUAL is a String datatype.

But when I am using a formula to copy to the new column VIRTUAL COLUMN, I have defined the column datatype as INT64.

 

Hence STRING to INT datatype  issue is happening.

 

Solution:

ShankerV_0-1682482189040.png

 

 

ShankerV_1-1682482199981.png

Many thanks

Shanker V

Yoshiro_Fujimori
15 - Aurora
15 - Aurora

Hi @Marcegon ,

 

The error message should say which Expression is in problem (as underlined in Green).

Yoshiro_Fujimori_0-1682481863985.png

Once you locate the expression, please double check if the data type of the result is numeric.

If IsNull([Actual # of Virtual Attendees])

THEN [Virtual est attendees]

ELSE [Actual # of Virtual Attendees]

ENDIF

 

If you still see the expression is OK, please consider attaching the workflow packaged with the input data.

Marcegon
8 - Asteroid

Hi, I am still learning Alteryx, so I am not sure what I need to do.  I am trying to add the numbers in (2) columns but I am getting the error I mentioned before, and the numbers are not adding up.  I selected the Function, then operator "addition" and data type int64 but it is not working.  See example below:

 

In Person      Virtual     Total Attendance

500                 28            50028

Yoshiro_Fujimori
15 - Aurora
15 - Aurora

Hi @Marcegon ,

 

In this kind of error, it is more effective to see the real data.

Can you save the workflow with menu

"Options > Export Workflow"

to package the data with the workflow and attach the package (.yxzp file)?

 

ShankerV
17 - Castor

Hi @Marcegon 

 

Could you please try the below.

 

Total Attendance

tonumber([Attendance - InPerson])+tonumber([Attendance - Virtual])

 

We can't do addition on String datatype, even though the numbers are stored in string.

Hence you can use tonumber([column name]) and then perform the addition.

 

Hope this helps!!!!!

 

Many thanks

Shanker V

Lakshya_05
8 - Asteroid

Hello,

Just use the ToNumber function when performing the addition on the last column as string data types cannot be added. That is why you need to use the tonumber() function to add the two columns.

 

Kindly refer to the below article to understand more about the tonumber() function.

https://help.alteryx.com/20223/designer/conversion-functions

 

Hope this helps.

Thanks,

Lakshya Pant

Marcegon
8 - Asteroid

This worked!  Thank you so much!

Marcegon
8 - Asteroid

Thank you!

Labels
Top Solution Authors