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

IF Error in the Alteryx

SH_94
11 - Bolide

Hi Community ,

 

I would like to seek your help to comment on the following screenshot as i not sure why the formula is not working in this case.

 

Could anyone please advise me on the mistake that i have made?

 

Thanks a lot.

Jacob_94_0-1615305568917.png

 

15 REPLIES 15
Luke_C
17 - Castor

@SH_94 

 

Based on the error message you are trying to apply a math function to a string. Can you check if Days or Invoice Amount (Ori) are strings? Once you update them to be numeric using a select tool it should work.

RolandSchubert
16 - Nebula
16 - Nebula

Hi @SH_94 ,

 

it seems, the field [Invoice Amount (Ori)] is a string field. Replace [Invoice Amount (Ori)]  by ToNumber([Invoice Amount (Ori)]) , thus you convert the string to a number and it should work.

 

Let me know if it works for you.

 

Best,

 

Roland

SH_94
11 - Bolide

Hi @ Lukecornetta and Aurora RolandSchubert,

 

Thanks a lot for your great information

SH_94
11 - Bolide

Hi RolandSchubert,

 

It appear the error as below after i put the formula : ToNumber. Can you please advise on this?

Jacob_94_0-1615306346478.png

 

RolandSchubert
16 - Nebula
16 - Nebula

Hi @SH_94 ,

 

you should use a new field (e.g. [Invoice Amount] and set the data type to double, currently you try to convert a string to a number, but the result is still a string field.  The formula should be ToNumber([Invoice Amount (Ori)], the error is caused by the "'" (first character in formula)

Hope this is helpful.

 

Best,

 

Roland

SH_94
11 - Bolide

Hi @ RolandSchubert,

 

If i change to double, it will show the following error. For instance, the value become 15 instead of 15171.32. May i know how to fix this error?

 

Jacob_94_0-1615306928276.png

 

RolandSchubert
16 - Nebula
16 - Nebula

That's strange. The decimal separator seems to be a ".", so the thousands separator is assumed to be a ",".

You could try ToNumber([Invoice Amount (Ori)], 0, 0, '.') 

SH_94
11 - Bolide

Hi @RolandSchubert,

 

Below are the two screenshot on the invoice amount setting.

Jacob_94_0-1615308278128.png

Jacob_94_1-1615308382267.png

 

However, it still give me 15 instead of 15,157.32.

 

May i know if the above setting is correct?

 

 

RolandSchubert
16 - Nebula
16 - Nebula

Okay, now I see the problem ... conversion by simply changing data type does not always do the job.

 

But - to solve your problem, only a small modification is needed.

 

In the Select tool, do not change the data type and field name (so the name is still [F4] and it's a V_WString).

In the Formula tool, add a new column and name it Invoice Amount (Ori)", set the data type to double and use the formula ToNumber([F4], 0, 0, '.')

 

The new field has the correct name and data type, it should show the right amount now. I'm not sure, if you need the field [Invoice Amount] for the connection to the RecordId tool, maybe you have to connect this to the formula tool.

 

 

Labels