0

I have the rule-based labelling provided for my labels, inside which I want to make other distinctions. Unfortunately, the multiple CASE WHEN seem to be not valid, as I get an error:

Parser Errors: syntax error, unexpected STRING syntax error, unexpected END, expecting $end

My code looks like this so far:

CASE WHEN
"rotate_angle" = 90 THEN
'10,0'
ELSE 
"rotate_angle" = 270 AND "Plan" = E
'8,10'
END

and I believe the situation is similar to this query:

QGIS Multiple CASE WHEN/THEN Statements for Expression Based Labels

where the rule-based styling was proposed. In my case it has been already applied, but I need a step further - a few rules inside of the given rule. Is it possible?

enter image description here

1
  • Please provide example data. I suppose the "rotate_angle" = 270 is superfluous, but can't confirm w/o having a look at the data.
    – Erik
    Apr 1, 2022 at 9:51

1 Answer 1

5

You can't have ELSE with a condition. ELSE is used for catch all others values, so it's a syntax error.

And E seems to be a literal value --> missing quote ('E')

CASE 
  WHEN "rotate_angle" = 90 THEN '10,0'
  WHEN "rotate_angle" = 270 AND "Plan" = 'E' THEN '8,10'
END

or just

CASE 
  WHEN "rotate_angle" = 90 THEN '10,0'
  ELSE '8,10'
END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.