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

Geographos
  • 4,087
  • 2
  • 27
  • 88
  • 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 01 '22 at 09:51

1 Answers1

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
JB D
  • 503
  • 2
  • 4