Oke I think I got the hang of cases now, but still I am learning. So I kind of am still making mistakes and I cannot exacly understand why.

Currently I want certain value's in a certain column to be deleted.

I am adding the field "Delete" expression to the column in edit attribute table. So I assume I do not need to add the column name since I am setting the Field calculator in that column: This is the expression:

DELETE '2013' and '2015' and '2016' END

However I always get syntax error, I am assume I am programming the expression wrong? Please let me know.

2 Answers 2


If your datefield is a Text the following should work.

 if(  "your_datefield" in ('2013', '2015', '2016'), NULL, "your_datefield" )

When it is safed as numbers you don´t need the quotation marks. If it is a real datefield it should look like this:

if(  year("your_datefield") in ('2013', '2015', '2016'), NULL, "your_datefield" )

The condition is checked in the first part of the if statement. If TRUE it is set to NULL, if FALSE it will set to your original value. The NULL is important in a good data keeping as it means that the value is not set (which is different than being 0 or an empty string).


Not sure what you doing: Writing you own version of a case statement with a delete command, saved as a text in a column and trying to get the field calculator to run an invalid expression??

Probably a better way would be to select the records, with the Select by expression editor, and then delete them with the delete button.

enter image description here

If your numbers are text you can write an select expression like:

"mycolumn" in ('2013','2015', '2016')

If your numbers are stored as numbers leave the pings:

"mycolumn" in (2013, 2015, 2016)

enter image description here

Delete selected features:

enter image description here

  • Thank you i will try it now if It works I will accept it as answered. Edit no This is not what I want, I want to delete the value's not the objects. In other words return them to default vallues Apr 10, 2017 at 9:07
  • I have accepted this question as answered, but it was not exacly what I want. But thanks anyway for the response. Apr 10, 2017 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.