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

asked Apr 1, 2022 at 9:45
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. Commented 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
answered Apr 1, 2022 at 9:59

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.