3

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

3

Use @row_number with case:

concat('GI_', case when length(@row_number)<2 then '0' else '' end, @row_number-1)
3

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

enter image description here

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.