I want to update an existing field with the number of values, in a range of preceeding fields. I could do this easily in EXCEL with "=NUMBER ARGUMENTS", but I want to learn this in QGIS.

I want to update the field named "totaal" with the number of 'x' in the preceeding fields. Count the arguments in fields "5 jul" to "12 sep".

enter image description here

| improve this question | | | | |
  • Could you edit your question please and provide an example of what you have and the result you would like? – Joseph Nov 11 '16 at 16:07
  • Upload a print screen of your fields. – aldo_tapia Nov 11 '16 at 16:15
  • Perhaps this post might help: Summarizing Fields based on content in QGIS? – Joseph Nov 11 '16 at 16:16
  • Thanks @Joseph, but I don't know how to work with Python... – Rob Nov 11 '16 at 16:25

Since you are not comfortable with python, here is the alternative method:

  1. Start edit session, open up table, and use Open Field Calculator tool to field calculate 0 for all features for the total field
  2. For each field you want to evaluate if field value equals 'x', use the Select features using an expression button within the table (e button) and run the selection one field at a time for any that may have 'x' value, e.g. "field1" = 'x'
  3. For each iteration of step 2 run the Field Calculator and increment the total field by total field value + 1 each time (this will apply the increment for only selected features), e.g. "total" + 1
  4. Repeat step 2 and 3 for all other fields that you want to evaluate for 'x'
  5. Stop and save edits
| improve this answer | | | | |

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.