1

In my attribute table of a shapefile I created a new field ('number') and I would like to fill it with:

enter image description here

  • and your question is? – LaughU Jan 22 '18 at 13:18
  • How can I create the sequence "1 1 1 2 2 2 3 3 3 ..." in a new field? – Quarantäne Jan 22 '18 at 13:32
  • ceil("id" / 3) – Kazuhito Jan 22 '18 at 13:35
  • I would like to have 3 times "1", than 3 times "2", than 3 times "3" and so on... – Quarantäne Jan 22 '18 at 14:15
6

When you create your new field do it like this:

Field calculator

The formula floor(("id" + 2) / 3) (or more simply as Kazuhito suggests ceil("id" / 3)) results in the pattern you are looking for:

Resulting attribute values

  • @Quarantäne if the answer resolved your question please accept it as correct. This is done with the tick mark next to the voting buttons. – HeikkiVesanto Jan 22 '18 at 15:02

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.