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

If without Else Expression

If I need to change field text using an If Statement, I have to write in in a format similar to this:

 

IF [Product Line]=="" THEN
    "Others"
ELSE
    [Product Line]
ENDIF

 

Having an Else statement increases processing time and statement complexity and in this case is unnecessary.  Please allow me to write my code in this manner:

 

IF [Product Line]=="" THEN
    "Others"
ENDIF 
6 Comments
Scott_Snowman
10 - Fireball

While not a solution or true workaround in the strictest, a time-saving syntax would be as follows:

 

 

IIF([Product Line]="","Others",[Product Line])

You still have to input two branches of logic but it's a bit quicker to type.

Scott_Snowman
10 - Fireball

If you're feeling ambitious, I believe you can also create a custom function on your own that does this.

 

See this link for more details, although I confess I haven't tried this myself. (On my machine, I'm restricted from accessing the necessary folders to load the XML files.)

Billbisco
7 - Meteor

Wow, I'll have to try the XML Custom function!  Thanks @Scott_Snowman

Doug_B
5 - Atom

I'm trying to do the same with isempty, unfortunately I don't see a solution here.

 

My formula which works is:

 

IF IsEmpty(Trim([Site])) THEN
  "Home"
ELSE
  [Site]
ENDIF

 

I would prefer:

 

IF IsEmpty(Trim([Site])) THEN
  "Home"
ENDIF

 

Or better:

 

IF IsEmpty(Trim([Site]))
  "Home"
ENDIF

 

Does anyone know if this can be done (lose the "Else")?

 

Jbell2432
5 - Atom

I tend to use the Switch Function for this. 

 

Switch([Product Name], [Product Name], '' ,'Others')

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team
Status changed to: Accepting Votes