More

Check for whole number in case statement


In an elevation file I want to find all the 5m contours and mark a column up as major. This has to be done in QGIS in the field calculator or modeler.

I want to do something like the following based on this post

CASE WHEN "elevation" %% 5 THEN 'major' WHEN "elevation" %% 1 THEN "moderate" ELSE "Minor" END

But this doesn't work -

Parser Error: syntax error, unexpected MOD

Eval Error: No root node! Parsing failed?

Ideally I want to run it as part of the following (which works but level 50 includes 1m and 5m contours)

CASE WHEN "contour_level" = 48 THEN 'minor' WHEN "contour_level" = 49 THEN 'minor' WHEN "contour_level" = 50 THEN 'moderate' ELSE 'Check' END

Based on the reply from @Joseph, I found that the following worked.

I needed 1m and 5m intervals not just 1m and 5m lines. I ended up with

[[CASE WHEN "elevation" % 1 THEN 'minor' WHEN "elevation" % 5 THEN 'moderate' ELSE 'major' END]]