2

I want the first column (ID_1) here (see image) to have numbers at the end of the text.

For example:

Column 1: GI_01, GI_02, GI_03 and so on. I used concat expression but it doesn't work at all as you can see in this image. Attribute table_Column 1(ID_1) I also tried to export it to CSV to auto-adjust the column and imported it to QGIS (as points ofcourse). When i tried to merge or join these column attribute table, it comes up with a NULL value or nothing at all.

0

2 Answers 2

2

Try this expression 'GI_' + lpad($id, 2, 0)

2
  • Expression is not valid when i try this with field calculator. Can you elaborate more on how to try this expression? Jun 29 at 2:58
  • 'GI_' || lpad($id, 2, 0) or 'GI_' || right('0' || $id, 2) Jun 30 at 7:08
2

Use @row_number with case:

concat('GI_', case when length(@row_number)<2 then '0' else '' end, @row_number-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.