I have a large file of several hundred thousand polygons. It's too many to have an individual colour, so I want to create a column of numbers to which I can assign a random colour. So how do I create a column in the attribute of numbers 1 to 50 on repeat?
1 Answer
If you want a number going from 1 to 50 and repeat, you can use the modulo %
operator combined with the @id
variable (older versions of QGIS can use $id
instead) :
@id % 50 + 1
(the color can be directly randomized with QGIS expressions but that is not the OP question)