Working in QGIS I have an attribute table containing details of polygons I have digitised, including the two fields, COLUMN_1 and COLUMN_2, each of which is a 4 character Integer that I entered.
However, having entered the last two characters of some entries in COLUMN_2 incorrectly, I now need to correct hundreds of records. Specifically the last two characters of the entry in COLUMN_2, for all COLUMN_1 records = 7777.
I could do this in a Spreadsheet but it's cumbersome and requires too many operations.
Opening the attribute table and starting the Field Calculator, I think the solution lies in the expression...
Case When 'COLUMN_1' = 7777 Then regexp_replace(input_string, regex, replacement)
End
or in my 'pseudocode' …
Case When 'COLUMN_1' = 7777 Then regexp_replace(“COLUMN_2”, right(contents of the field ,2), 99)
End
Am I working the right direction and if so how do I write this expression correctly?
The example below illustrates the problem.
CASE WHEN "COLUMN_1" == '7777' THEN replace(right("COLUMN_2", 2), '99')
replace( "COLUMN_2" , right("COLUMN_2",2), '99')
.