Monday 19 August 2019

Syntax of conditional statements in QGIS Field Calculator(s)


I have a shapefile which I need to modify. There is one column "CLASS" with the attributes: "A", "B" and "C". I need to change "A" into "1", "B" into "2" and "C" into "3". I tried it with case when function. With one case it's not a problem but how does it work with 3 in row?


Is it also possible to build a model with the FieldCalculator function?




I guess I figured it out! Is this right?



CASE
WHEN "VSt_K" IS 'E' THEN '5'
WHEN "VSt_K" IS 'A' THEN '1'
WHEN "VSt_K" IS 'B' THEN '2'
WHEN "VSt_K" IS 'C' THEN '3'
END

But I can't use this in the modeler FieldCalculator function...




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...