4

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?

asked Feb 3, 2015 at 11:26
1
  • Well Joshua, take your pick :). All answers should work. Commented Feb 3, 2015 at 11:47

3 Answers 3

3

Simple solution:

'A' || "column name" 

in a new field of type String.

answered Feb 3, 2015 at 11:43
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.

answered Feb 3, 2015 at 11:44
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!

answered Feb 3, 2015 at 11:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.