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

If output returns "-1" instead of text value specified

mmytrunec
5 - Atom

I'm solving a weekly challenge and my IF function output is "-1" or "0" when it should display "True" or" False". I'm attempting to generate a column that will show "True" if the "Type" column displays "Burger" or "Pizza" and will display "False" if the type column is a different result.   

 

Can anyone advise if there is an issue with my syntax? 

 

I've attempted the same formula using IFTHEN, and IIF and neither generates the desired output. 

 

mmytrunec_0-1678816849542.png

mmytrunec_1-1678816929190.png

 

mmytrunec_2-1678816957571.png

 

 

 

6 REPLIES 6
BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@mmytrunec hey nothing wrong with your syntax. -1 would be indicating true, 0 would indicate false. It's just another way to display it!

 

All the best,
BS

LinkedIN

Bulien
mmytrunec
5 - Atom

Thank you kindly @BS_THE_ANALYST . Is there a way I can adjust the output so that it displays "TRUE" and "False" instead of the numbers? 

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@mmytrunec I'd just advise looking at your logic again:

BS_THE_ANALYST_0-1678817383509.png

 

 

All the best,
BS

LinkedIN

Bulien
binuacs
21 - Polaris

@mmytrunec Change the datatype to Bool to see the values True or False

 

binuacs_0-1678817615925.png

 

 

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@mmytrunec my advise would be to only use one IF statement per formula box i.e:

BS_THE_ANALYST_0-1678817470604.png

if you want to add more checks, utilise the ELSEIF statement inside your IF statement, i'll show an example below this:

BS_THE_ANALYST_1-1678817549814.png

Have a read through the statement above, and check the output. Hopefully that clears things up for you @mmytrunec . Any questions let me know.
BS

 

All the best,
BS

LinkedIN

Bulien
mmytrunec
5 - Atom

Converting the datatype to "BOOL" for the below formula generated the desired outcome (image 1). Updating the function so that the "or" was within one IF function also generated the desired outcome (image 2). Thank you all for the assistance!  

 

mmytrunec_0-1678817935639.png

mmytrunec_1-1678817969927.png

 

 

 

Labels
Top Solution Authors