1

This question is actually similar to another question I had asked, but this is more a response question, since I am limited to only one question per topic. SO PLEASE READ THIS FULLY.

"Using replace function to replace value to one of value map using QGIS field calculator?."

Also this problem I underfound is not related to the situation I asked that question in. The problem is that the replace function also changes the text that is has in "common" of the field value I want to replace.

I discovered a new problem with the replace function and that is it also changes the text of value's that is "common text".

Let say I have I want to change the text '2015', '2016' and '2017' to 'n.v.t.'. This works great with the replace function, however there is another text called VJ2015. When I execute the 2015 replace command it also changes this to 'vjNULL'. Again not what I want, since I only wanted that "specefic text value" to be changed not the text that is "common" with other value's. So here is my case expresion':

replace("VJ/NJ (LC)", '2013' and '2014' and '2015', NULL)

I know that programs like Excel and others have "Identical letter option", I suspect that there is a way for QGIS to turn this option on.

I also understand that "" stands for column and '' stands for the value, so I suspect I need to type some specific special character to "Indenitical on" but I do not know which. So what do I need to do?

5

If you want to replace values which only contain '2015', '2016' and '2017', you could use a CASE statement:

CASE
WHEN "fieldName" in ('2015', '2016', '2017') 
THEN 'n.v.t' 
ELSE "fieldName"
END

This will not affect values which contain the values you specify (i.e. VJ2015 will remain the same and will not be changed to n.v.t)

1

Try with:

CASE  
WHEN  "VJ/NJ (LC)"  not like 'VJ2015'  
THEN  replace("VJ/NJ (LC)", '2013' and '2014' and '2015', NULL)  
END

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.