I have field values that are:
- OG_S_G4,
- OG_S_G3,
- OG_S_G2, etc.
and I want to change the OG to LIP whilst keeping all the text after (i.e. LIP_S_G4), is there a way to do this?
Create a new field with a type of text (string), and in the field calculator just use the following expression in a new field:
replace("fieldName",'OG','LIP')
where the fieldName
is the name of the field that holds the texts OG_S_G4, OG_S_G3, OG_S_G2
You can add a new column using the field calculator in the attribute table of your data.
Using the following code you can add new data labels based on existing ones.
CASE
WHEN "column_name"= 'OG_SG4' THEN 'LIP_S_G4'
WHEN "column_name"= 'OG_SG3' THEN 'LIP_S_G3'
WHEN "column_name"= 'OG_SG2' THEN 'LIP_S_G2'
END
Make sure that you set the correct output field type, in this case "Text (string)".