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 Ideas

Share your Designer Desktop product ideas - we're listening!
Submitting an Idea?

Be sure to review our Idea Submission Guidelines for more information!

Submission Guidelines

Allow ending of if statements after a single condition

*Simply a QoL suggestion & apologies in advance if this isn't possible within the constraints of Alteryx*

 

As it stands right now, if statements require an 'else' condition 100% of the time.

 

DataNath_1-1664553404168.png

DataNath_2-1664553661412.png

 

However, there are many times where users just need to flag a certain condition and don't care about what the other outcome is, often just needing this to filter or sense check etc. Therefore the idea is simple: allow users to immediately ENDIF a statement after a single if condition, much like we can do in Tableau. When a statement is written in this way, the missing 'else' just defaults to nulling the value if the single condition isn't met:

 

DataNath_0-1664553381023.png

 

Sorry if this has been previously suggested but haven't spotted anything from a look around the ideas area.

 

Cheers!

4 Comments
cgoodman3
14 - Magnetar
14 - Magnetar

You should be able to evaluate to just True and False, so in your example you can write the expression Contains([Name],”0”) and it doesn’t need to be written as an IF statement. However if you want a result which is different to True or False you will need to add an IF statement to evaluate it still. 
Do you have an expectation as to what the outcome will be when the result is false? For example should it be null?

DataNath
17 - Castor
17 - Castor

Hi @cgoodman3, my apologies, I now realise I used a bad example to demonstrate this as the contains formula can just evaluate T/F and in my example I've used 1 & 0 for outcomes. However, the actual idea was targeted more to users who may want a more substantial flag i.e.

 

IF Contains([Name],'a') THEN 'Keep this record' ENDIF

 

The expectation would be that, much like Tableau, if no 'ELSE X' is supplied and the ENDIF comes immediately after the single condition, Alteryx would null records that don't satisfy this by default.

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team
Status changed to: Accepting Votes
 
marcusblackhill
12 - Quasar
12 - Quasar

I agree, a "don't do anything" statement for the else should be implicit in case the user don't explicitly point out some action, for the cases you are changing an existent field.

 

The issue on that would be for new columns, but implicitly set null could be a simple solution for that case. To be honest, I would still prefer to add both statements to be more clear, but I believe I'd use it more for the cases of IFs inside IFs to make it cleaner.