community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More
We will be upgrading the Gallery to our 2019.4 release this Saturday, December 7th beginning at 9:00am MT. We expect the outage to take last approx. 2.5 hours.
SOLVED

Formula-in-database - syntax error - help

Highlighted
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!

Alteryx Certified Partner
Alteryx Certified Partner

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

 

Cheers,

Alteryx
Alteryx

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