1

When incorporating the field calculator into the graphical modeler in QGIS is it possible to update an existing field without having to create a new field and then remove the existing.

For example I have a field called "MEAN" and lets say we have one record with a value of 100. Is it possible to update that field with the following simple sum "MEAN" / 10. I know this is possible outside of the modeler environment by using the "Update existing field" tick box but I can't seem to replicate this in the modeler enter image description here

0

1 Answer 1

3

You can do this by just setting the input field to an already existing one. You can either type it by hand or use a model input:

enter image description here

or

enter image description here


Here is an alternative, I personally prefer: Use "refactor fields" instead of "field calculator". This tool has some advantages:

  • You can use input-variables in your expression (in field calculator you can not choose them from the expression list, and if you enter them manually, they often fail to work)
  • You can add several calculations at once
  • You can also change the fieldname and fieldtype if you want to

Only disadvantage is, that fields not listed here will be dropped. So if you have a huge list or variing fields, its better to stick with field calculator.

enter image description here

*in my example im using "id" as field instead of "mean"

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.