1

In QGIS, I'm trying to input either 'Yes' or 'No' for a new field based upon the input of values of another 9 fields. I've attached a screenshot of what I'm trying to accomplish. Essentially if there is a 'Yes' in any of the 9 previous fields, then the new field will input 'Yes'. If however all 9 fields are NULL, then the new field will input 'No'.

enter image description here

  • Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq. – underdark Nov 15 '17 at 18:14
2

You are looking for this function:

coalesce(NULL, 'Yes', NULL, 'No')

'Yes'

coalesce(NULL, NULL, NULL, 'No')

'No'

Returns the first non-NULL value from the expression list. This function can take any number of arguments.

So it will return the first non-NULL value it finds so if you make No the last value it will fallback to that value and report that.

coalesce("Field1", "Field2", "Field3", 'No')

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.