3

I'm using QGIS to calculate total loss in an earthquack attack. I wrote this expression in Field Calculator.

CASE 
WHEN  "build_type"  = 1 AND  "MMI"  < 5  THEN  "perc_loss"  = 0
WHEN  "build_type"  = 1 AND  (5 >= "MMI" AND "MMI" < 6) THEN  "perc_loss"  = 20
WHEN  "build_type"  = 1 AND  (6 >=  "MMI" AND "MMI" < 7) THEN  "perc_loss"  = 28
WHEN  "build_type"  = 1 AND  (7 >=  "MMI" AND "MMI" < 8) THEN  "perc_loss"  = 33
WHEN  "build_type"  = 1 AND  (8 >=  "MMI" AND "MMI" < 9) THEN  "perc_loss"  = 35
WHEN  "build_type"  = 1 AND  (9 >=  "MMI" AND "MMI" < 10) THEN  "perc_loss"  = 71
WHEN  "build_type"  = 1 AND   "MMI"  >= 10 THEN  "perc_loss"  = 95 END

There's no error/invalid warning, but no value resulted. Is there any wrong syntax I used? Anyone can help please? :)

3

I think it should be

CASE 
WHEN  "build_type"  = 1 AND  "MMI"  < 5  THEN   0
...

without the "perc_loss" = part

  • all done @underdark Well, i'm new in this site :) – Dwi Mar 6 '16 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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