Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Malformed IF Statement Error

Karl_Spratt
8 - Asteroid

Hi Community,

 

Getting this Malformed IF Statement  Error can someone please explain how to fix this.

 

IF [PGI Date] = 'Check Date' THEN "Backlog" ELSEIF
IIF(isEmpty([PGI Date]), "Shipped", "Backlog")
ENDIF

 

TIA 

Karl. 

4 REPLIES 4
CarliE
Alteryx
Alteryx

@Karl_Spratt 

 

You can shorten the logic here -- try this

 

IF isEmpty([PGI Date]) THEN "Shipped" ELSE "Backlog"
ENDIF

 

This is stating that any empty field in PGI Date will be categorized as Shipped otherwise its categorized as Backlog 

 

 

If this helped to solve your issue, please make sure to mark it as a solution to help out other members on the community!

 

Thanks

Carli
binuacs
17 - Castor

@Karl_Spratt 

 

IF [PGI Date] = 'Check Date' THEN "Backlog" 
ELSEIF isEmpty([PGI Date]) Then "Shipped"
ELSE  "Backlog"
ENDIF
DataNath
14 - Magnetar

Does the following work as expected? As it stands, you always need an ELSE statement to escape your IF as the final possible outcome - as you were trying to use the immediate if after an elseif you weren't leaving space to supply this: 

 

IF [PGI Date] = 'Check Date' THEN "Backlog" ELSEIF
isEmpty([PGI Date])) THEN "Shipped"

ELSE "Backlog"
ENDIF

 

The following may also work if I'm reading this right and slightly simplifies things:

 

IF [PGI Date] = 'Check Date' or !isempty([PGI Date]) THEN "Backlog"

ELSE "Shipped"
ENDIF

Karl_Spratt
8 - Asteroid

Thanks All for your help - I used DataNath's solution.

Really appreciate the help and advice.

 

Cheers,

Karl. 

Labels