In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula-in-database - syntax error - help

hash9
7 - Meteor

Can someone help me fix the error?

 

SQL Expression:

if ('X' <= 14000 and 'X' >= 10000) then "10-14"
elseif ('X' <= 10000 and 'X' >= 8500) then "8.5-10"
elseif ('X' < 14000) then "U/14"
elseif ('X' > 14000) then "O/14"
else "U/8.5"
endif

 

ERROR:

Formula In-DB (35) Error SQLPrepare: [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while execurint query. Error message from server: Error while compiling statement: FAILED: ParseException line 1:499 mismatched input 'then' expecting ) near ')' in function specification.

 

Thanks!

2 REPLIES 2
Thableaus
17 - Castor
17 - Castor

Try to use case..when...then instead of if..then.

 

Cheers,

ZacharyM
Alteryx Alumni (Retired)

While I am not a hortonworks expert, I dont think that CASE [Col] WHEN [Cond] THEN [Outcome] will work because of the use of >, >=, <, <= operators.

 

I would try removing the final 'if' from the endif, as in SQL operators, an if statement is usually ended by a simple end, not endif.

Labels
Top Solution Authors