In a SharePoint 2013 list there are 15 priority items. Each item is assigned a 'priority number' from 1 - 15. Sometimes there are only 10 items that are active in the list.
When an item, for example priority number 5, is 'Archived' (choice column 'yes' or 'no'), it is no longer counted in the priority order (it still exists in the list and has a priority number, but is no longer displayed on most views). I am trying to update all active items in the list ('Archive' equals 'no') to updated their priority number. Number 6 becomes number 5, number 7 becomes number 6, and so on. So that there is always Priority 1-10, without any repeats of numbers (no use of a number twice).
How do I loop through all active items in the list and update their priority number?