3

When I try to do a field calculation from the Processing Toolbox in QGIS 3 it performs the calculation on all records instead of the selected records. Is there a way to have the calculation performed only on the selected records using the Processing Toolbox Field Calculator?

The field calculator from the menu bar includes an option to "Only update [X] selected records" but that is missing from the Processing Toolbox.

Here's the dialog box from the Processing Toolbox: Processing Toolbox Field Calcator

Here's from the menu bar (and the attribute table)

Menu Bar Field Calculator

I'm ultimately setting this all up in the Graphical Modeler so if there's a work around that fits there, that's ok.

6

You can use is_selected() function in if statement to perform calculation on just selected features.

enter image description here

2

May be update to QGIS 3.2. It works at me

enter image description here enter image description here

--EDIT--

In the Processing toolbox, it works with an extraction (but not with a selection). I don't understand the difference

enter image description here

  • @JS_UNC asks "How do I execute a field calculation on just selected records from Processing Toolbox". Your field calculator screenshot is executed one from attribute table. – Kadir Şahbaz Jul 31 '18 at 12:35
  • Sorry, i have read the message form @JS_UNC too rapidly. May be my edit can help him – Christophe Jul 31 '18 at 12:54
  • 1
    Interesting. As I understand it Extraction creates two layers from an input layer, so it makes sense that then the field calculator would work on the extracted layer because it is still performing the calculation on all records - this time its the records in the extracted layer. – JS_UNC Jul 31 '18 at 13:36

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.