I'm currently trying to built a database for a cocoa plantation. I would like to know how to fill my database easily with the field calculator. For example I would like to have a specific value for my field "Varieté", but not for all the column.

Is it possible to put the value "Upala Silva" only for the "ID" 1 to 70?


2 Answers 2


From Field Calculator, Check Update existing field, and select "Varieté" field. Then, you can use the following conditional statement in the field calculator:

when "ID" <= 70 then 'Upala Silva'
when ("ID" > 70  and "ID" <= 100) then 'bbbbb'
else 'ccccc'

The other conditions are just an example on how to add different ranges. Therefore, you may need to change "ID" <= 100 to a different value according to your needs. Don't forget to remove the dots if you don't have other conditions.

  • Thanks for your answer, i will try it !
    – A.Badouk
    Jun 9, 2020 at 0:32

Additionally to ahmadhand's solution you may try using if-function.

if("ID" <= 70, 'Upala Silva', '')

function if

Tests a condition and returns a different result depending on the conditional check.




  • condition the condition which should be checked
  • result_when_true the result which will be returned when the condition is true or > another value that does not convert to false
  • result_when_false the result which will be returned when the condition is false or another value that converts to false like 0 or ''. NULL will also be converted to false.

More about Conditional Functions you can find here.

Your Answer

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

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