Field calculator has a great function under "Records" called "$rownum" which returns (assigns) the number of the current row.
Is there a way to make it work together with sorting? Lets say I want to sort table by column "length" and get the order (sequence) of lines by length from shortest to longest.
I know I can use some office spreadsheet software easily for this to sort by column and populate new column with order (sequence). But I would prefer to do the whole job in QGIS.
Update: As workaround there is also How to change the order of features in a shapefile? - using mmqgis plugin and function modify/sort and after that use "$rownum" on the new saved file.