Start Free Trial

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Parse Error at char(0): Empty expression (Expression #2)

u211968
5 - Atom

Hi I am having issues with a formula

 

IF [Key Account]="1" THEN "Key Account"
ELSEIF [Key Account]="0" THEN "Not Key Account"

 

Can you please advise what I am not doing correctly?

 

thanks,

 

Deirdre

3 REPLIES 3
DataNath
17 - Castor
17 - Castor

Hey @u211968, this error indicates that you've got another empty expression somewhere like so:

 

DataNath_0-1666685770091.png

 

As a side: the formula in your post above won't work if they're the only 2 outcomes you want to deal with. You'd need something like the following instead:

 

IF [Key Account]="1" THEN "Key Account"
ELSE "Not Key Account"
ENDIF

 

(Assuming your [Key Account] field is a string and not numeric - if it is numeric you'll need to remove the quotes around the 1). 

Deano478
12 - Quasar

Just to Add to the solution provided by DataNath the expression ELSEIF is not accepted by Alteryx I believe they call it an IF THEN ELSE statement on Alteryx. Hopefully this little titbit of information may help you going forward in your Alteyrx Journey :)

DataNath
17 - Castor
17 - Castor

Hey @Deano478, ELSEIF is available to use in Alteryx, for IF statements that require more than 2 outputs i.e. a straightforward IF A THEN ... ELSE ... 

 

Here's an example, where we want to provide a flag for either A or E and then deal with anything else in another way - the ELSEIF essentially 'restarts' the IF statement for a new check and we can use as many of these as we want in between the original IF and the final ELSE:

 

DataNath_0-1666689125217.png