2

I have a table with 2 fields: NUMBER (integer) and TOWN (text). I would like to find an expression that fills the NUMBER field with an automatic number specific for each value of TOWN. Example: NUMBER | TOWN
----------------------
1 | STRASBOURG
2 | STRASBOURG
3 | STRASBOURG
1 | PARIS
2 | PARIS
1 | TOULOUSE
2 | TOULOUSE
3 | TOULOUSE
4 | TOULOUSE
How can I do that with a QGIS expression ?

4

Finally, I found the right expression to do that:

"TOWN" ||( @row_number - minimum(  @row_number , "TOWN") +1)

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.