3

I have a column in my my attribute table that contains a series of individually numbered locations. I wish to prefix all of these numbers with a letter, this letter will be the same for each of the values. E.g. 100, 200 and 300 would become A100, A200 and A300. I have a lot of data so simply going through and renaming would take a lot of time.

I have a feeling this would be achieved through the Field Calculator but unsure of which expression would be best for this?

  • Well Joshua, take your pick :). All answers should work. – Joseph Feb 3 '15 at 11:47
2

Simple solution:

'A' ||  "column name" 

in a new field of type String.

1

You can use:

concat('A', "your_column" )

Note: Your column must accept Strings so if your current column type is set to integer, you will have to create a new field in the Field Calculator and set it to String.

1

The expression would be, for example:

'A'  ||  "someField" 

someField would be your field that you want to use when updating and || is used to concatenate strings in QGIS.


EDIT:
Make sure the values are put in between single quotes and the field names are put in between double quotes!

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.