To get the data, we need to know the highest integer value in the list and build a loop from 1 to that number. I named my column 'dg' (DataGrouping).
You'll see that I sort by ID (descending) and request the first 'dg' value, which is the largest based on the sorting. Using 'Max' on 'dg' also triggered a delegation warning.
Set( varLastDG, First( Sort( <SP List>, ID, SortOrder.Descending ) ).dg )
Now build the loop (ForAll). Use 'Sequence' to create a list of numbers from 1 to varLastDG.
ForAll( Sequence(varLastDG), Collect( <collection name>, Filter( <SP list>, dg = Value, Department = "R&D", Active = true ) ) )
The extra filters on 'Department' or 'Active' can reduce the number of returned records and speed up the entire process. Not every loop will return exactly 2K records – it might return none at all.
Add your collection to a grid to visualize the result. That's all you need to collect your data!
Now you need to make sure every record gets the correct integer value. You also need to make sure you don't add the same value more than 2K times.