2

I'm not sure what I'm missing here. I'm trying to use the field calculator to concatenate multiple fields into one new. All fields are identified as strings.

My expression:
concatenate( "Building" || '-' || "Floor" || '-' || "Area2" || '-' || "Room Numbe" )

Expected Results: 6-01-A-02

Actual results: 6-01-A-026-01-A-016-01-A-096-01-A-106-01-A-086-01-A-066-01-A-05

Basically the calculator is concatenating all records across the above fields until reaching the character limit. I'm not sure how to only concatenate by record.

3

concatenate() works on all records and merge them.

To work on a single record, you can use the concatenation operator ||

 "Building" || '-' || "Floor" || '-' || "Area2" || '-' || "Room Numbe" 

or you can use the concat() function

concat("Building" , '-' , "Floor" , '-' , "Area2" , '-' , "Room Numbe" )
| improve this answer | |
  • Thank you. I had tried both of these before and was getting a NULL value in the preview. I think it was just because I was editing multiple features. Upon further investigation, it did work as expected. – Heather May 22 at 21:48

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.