Sunday 18 June 2017

qgis - How to use the replace string function in Field Calculator?


Within an attribute table I'm trying to replace one string with another using the 'replace' function . As an example, there are a number of features whose field 'NAME' contain the string '(B)' and I'm wanting to replace this with the word 'County'. I'm selecting the 'update existing field' checkbox and using the following expression


 replace( '(B)','(B)','County')


The end result is that the field 'NAME' for every feature is replaced by 'County' irrespective of whether or not the field 'NAME' originally contained the string '(B)'. Any help would be appreciated.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...