I wanted to create a column and populate it with data based on data from other fields.

If column_1 contains fields which has similar string (eg. field_1 = "Country: UK", field_2 = "Country: US", field_3 = "City: London"), is there an expression to update fields which ONLY contain part of the string - in this case "Country"?


This is connected to a related question I asked earlier: Create and immediately update field using Field Calculator

Following on from Matthias' answer, this expression allowed me to add a filter and populate NewColumn in just one step:

case when "column_1" ILIKE '%Country%' then 1
else 0

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.