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".
asked Nov 11, 2016 at 16:02
-
Could you edit your question please and provide an example of what you have and the result you would like?Joseph– Joseph2016年11月11日 16:07:21 +00:00Commented Nov 11, 2016 at 16:07
-
Upload a print screen of your fields.aldo_tapia– aldo_tapia2016年11月11日 16:15:02 +00:00Commented Nov 11, 2016 at 16:15
-
Perhaps this post might help: Summarizing Fields based on content in QGIS?Joseph– Joseph2016年11月11日 16:16:42 +00:00Commented Nov 11, 2016 at 16:16
-
Thanks @Joseph, but I don't know how to work with Python...Rob– Rob2016年11月11日 16:25:26 +00:00Commented Nov 11, 2016 at 16:25
1 Answer 1
Since you are not comfortable with python, here is the alternative method:
- Start edit session, open up table, and use Open Field Calculator tool to field calculate 0 for all features for the total field
- 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'
- 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
- Repeat step 2 and 3 for all other fields that you want to evaluate for 'x'
- Stop and save edits
answered Nov 11, 2016 at 16:53