Alteryx Designer Desktop Discussions

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

Formula Error

thalil
6 - Meteoroid

Hello, 

 

We are trying to use the following formula to separate the payable and receivable amounts if they are greater or less than zero, however there is a parse error. A new column should be created indicating if the entry is a payable or receivable based on the signage of the original amount column. 

 

Thank you  

8 REPLIES 8
JamesCharnley
13 - Pulsar

Hi @thalil 

 

Couple of things don't look quite right in the screenshot. First of all you can't have two separate if statements in the same single formula, and they aren't structured quite correctly. I believe you'd want something like:

 

If [Original Amount] > 0 then "BankCorp Payable" 

elseif [Original Amount] < 0 then "BankCorp Receivable"

else '0'

endif

 

 

DanielG
12 - Quasar

@thalil 

That is 2 if statements in the same formula...

 

Is this what you want to do?  It will leave it blank if the Amount field is also empty

 

if [Original Amount] >0 then "Bankcorp Payable"
elseif
[Original Amount]<0 then "Bankcorp Receivable"
else
""
endif

thalil
6 - Meteoroid

Hi, 

 

Thank you for the solution, however I am still seeing an error message using this formula. Here is a screenshot of the formula. 

JamesCharnley
13 - Pulsar

@thalil check the data type of the [Original Amount] field. My guess is that it's a string so can't be compared against 0, so you'll need to change it to a numeric data type, such as double.

thalil
6 - Meteoroid

The original amount data has been changed to double but there is still an error message. Here is a screenshot of the Parse error. 

DanielG
12 - Quasar

@thalil - check to see if there is a line break in the "Bankcorp Receivable" that you wrote in the formula tool.

 

It looks like it is just wrapping for lack of available space, but I am wondering if you accidentally hit enter to get to the second line?

 

Not sure that will solve it but it is worth a shot.

DanielG
12 - Quasar

Try wrapping the 0s in the formula in quotes too.  If that works than there is still an issue with the data type coming into the formula.

thalil
6 - Meteoroid

Thank you! I just tried this and the formula is working!

Labels